003 File Manager
Current Path:
/usr/src/contrib/llvm-project/clang/lib/Analysis
usr
/
src
/
contrib
/
llvm-project
/
clang
/
lib
/
Analysis
/
📁
..
📄
AnalysisDeclContext.cpp
(20.62 KB)
📄
BodyFarm.cpp
(30.09 KB)
📄
CFG.cpp
(199.8 KB)
📄
CFGReachabilityAnalysis.cpp
(2.55 KB)
📄
CFGStmtMap.cpp
(2.37 KB)
📄
CallGraph.cpp
(7.69 KB)
📄
CloneDetection.cpp
(22.11 KB)
📄
CocoaConventions.cpp
(4.49 KB)
📄
CodeInjector.cpp
(501 B)
📄
ConstructionContext.cpp
(9.16 KB)
📄
Consumed.cpp
(43.16 KB)
📄
Dominators.cpp
(611 B)
📄
ExprMutationAnalyzer.cpp
(19.82 KB)
📄
LiveVariables.cpp
(20.74 KB)
📄
ObjCNoReturn.cpp
(1.95 KB)
📄
PathDiagnostic.cpp
(42.18 KB)
📄
PostOrderCFGView.cpp
(1.74 KB)
📄
ProgramPoint.cpp
(7.59 KB)
📄
ReachableCode.cpp
(24.67 KB)
📄
RetainSummaryManager.cpp
(47.54 KB)
📄
ThreadSafety.cpp
(91.72 KB)
📄
ThreadSafetyCommon.cpp
(33.56 KB)
📄
ThreadSafetyLogical.cpp
(4.1 KB)
📄
ThreadSafetyTIL.cpp
(11.12 KB)
📄
UninitializedValues.cpp
(31.88 KB)
📁
plugins
Editing: CFGStmtMap.cpp
//===--- CFGStmtMap.h - Map from Stmt* to CFGBlock* -----------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file defines the CFGStmtMap class, which defines a mapping from // Stmt* to CFGBlock* // //===----------------------------------------------------------------------===// #include "llvm/ADT/DenseMap.h" #include "clang/AST/ParentMap.h" #include "clang/Analysis/CFG.h" #include "clang/Analysis/CFGStmtMap.h" using namespace clang; typedef llvm::DenseMap<const Stmt*, CFGBlock*> SMap; static SMap *AsMap(void *m) { return (SMap*) m; } CFGStmtMap::~CFGStmtMap() { delete AsMap(M); } CFGBlock *CFGStmtMap::getBlock(Stmt *S) { SMap *SM = AsMap(M); Stmt *X = S; // If 'S' isn't in the map, walk the ParentMap to see if one of its ancestors // is in the map. while (X) { SMap::iterator I = SM->find(X); if (I != SM->end()) { CFGBlock *B = I->second; // Memoize this lookup. if (X != S) (*SM)[X] = B; return B; } X = PM->getParentIgnoreParens(X); } return nullptr; } static void Accumulate(SMap &SM, CFGBlock *B) { // First walk the block-level expressions. for (CFGBlock::iterator I = B->begin(), E = B->end(); I != E; ++I) { const CFGElement &CE = *I; Optional<CFGStmt> CS = CE.getAs<CFGStmt>(); if (!CS) continue; CFGBlock *&Entry = SM[CS->getStmt()]; // If 'Entry' is already initialized (e.g., a terminator was already), // skip. if (Entry) continue; Entry = B; } // Look at the label of the block. if (Stmt *Label = B->getLabel()) SM[Label] = B; // Finally, look at the terminator. If the terminator was already added // because it is a block-level expression in another block, overwrite // that mapping. if (Stmt *Term = B->getTerminatorStmt()) SM[Term] = B; } CFGStmtMap *CFGStmtMap::Build(CFG *C, ParentMap *PM) { if (!C || !PM) return nullptr; SMap *SM = new SMap(); // Walk all blocks, accumulating the block-level expressions, labels, // and terminators. for (CFG::iterator I = C->begin(), E = C->end(); I != E; ++I) Accumulate(*SM, *I); return new CFGStmtMap(PM, SM); }
Upload File
Create Folder