diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-12-21 01:30:23 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-12-21 01:30:23 +0000 |
commit | 6d42f4d8b8a176336a8c49ec3cf5f7fb6545ccfd (patch) | |
tree | a4f2b31f0fde74b42d486050507d0a43d9f772bc /include/clang/Analysis | |
parent | 0db661e67f613f49d047cdf53da29b9741234ad8 (diff) |
Revert r170826. The output of
./bin/clang -cc1 -internal-isystem /home/espindola/llvm/build/lib/clang/3.3/include/ -analyze -analyzer-checker=debug.DumpCallGraph /home/espindola/llvm/clang/test/Analysis/debug-CallGraph.c -fblocks
changes in each run.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170829 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis')
-rw-r--r-- | include/clang/Analysis/CallGraph.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/include/clang/Analysis/CallGraph.h b/include/clang/Analysis/CallGraph.h index a47cf1358b..d554f3a7af 100644 --- a/include/clang/Analysis/CallGraph.h +++ b/include/clang/Analysis/CallGraph.h @@ -39,9 +39,15 @@ class CallGraph : public RecursiveASTVisitor<CallGraph> { /// FunctionMap owns all CallGraphNodes. FunctionMapTy FunctionMap; - /// This is a virtual root node that has edges to all the functions. + /// This is a virtual root node that has edges to all the global functions - + /// 'main' or functions accessible from other translation units. CallGraphNode *Root; + /// The list of nodes that have no parent. These are unreachable from Root. + /// Declarations can get to this list due to impressions in the graph, for + /// example, we do not track functions whose addresses were taken. + llvm::SetVector<CallGraphNode *> ParentlessNodes; + public: CallGraph(); ~CallGraph(); @@ -85,6 +91,12 @@ public: /// failing to add a call edge due to the analysis imprecision. typedef llvm::SetVector<CallGraphNode *>::iterator nodes_iterator; typedef llvm::SetVector<CallGraphNode *>::const_iterator const_nodes_iterator; + nodes_iterator parentless_begin() { return ParentlessNodes.begin(); } + nodes_iterator parentless_end() { return ParentlessNodes.end(); } + const_nodes_iterator + parentless_begin() const { return ParentlessNodes.begin(); } + const_nodes_iterator + parentless_end() const { return ParentlessNodes.end(); } void print(raw_ostream &os) const; void dump() const; @@ -158,6 +170,7 @@ public: void addCallee(CallGraphNode *N, CallGraph *CG) { CalledFunctions.push_back(N); + CG->ParentlessNodes.remove(N); } Decl *getDecl() const { return FD; } |