aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Frontend
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-07-02 20:21:48 +0000
committerTed Kremenek <kremenek@apple.com>2012-07-02 20:21:48 +0000
commit371b477836f289f2e9caaab58530f187b51bc86d (patch)
treebbdf1f13383329ac98762238b1e0f1bd36c84dcf /lib/StaticAnalyzer/Frontend
parent56e9b0d28ed8d496a0cbd7fd0f22fbcf2f64acfa (diff)
Fix subtle bug in AnalysisConsumer where we would not analyze functions whose parent
in the call graph had been inlined but for whatever reason we did not inline some of its callees. Also, fix a related traversal bug where we meant to do a BFS of the callgraph but instead were doing a DFS. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159577 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Frontend')
-rw-r--r--lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
index 76e102c06a..05fb0155f1 100644
--- a/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
+++ b/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp
@@ -22,6 +22,7 @@
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Analysis/CFG.h"
#include "clang/Analysis/CallGraph.h"
+#include "clang/Analysis/Analyses/LiveVariables.h"
#include "clang/StaticAnalyzer/Frontend/CheckerRegistration.h"
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Checkers/LocalCheckers.h"
@@ -347,7 +348,7 @@ void AnalysisConsumer::HandleDeclsGallGraph(const unsigned LocalTUDeclsSize) {
for (llvm::SmallVector<CallGraphNode*, 24>::reverse_iterator
TI = TopLevelFunctions.rbegin(), TE = TopLevelFunctions.rend();
TI != TE; ++TI)
- BFSQueue.push_front(*TI);
+ BFSQueue.push_back(*TI);
// BFS over all of the functions, while skipping the ones inlined into
// the previously processed functions. Use external Visited set, which is
@@ -357,6 +358,13 @@ void AnalysisConsumer::HandleDeclsGallGraph(const unsigned LocalTUDeclsSize) {
CallGraphNode *N = BFSQueue.front();
BFSQueue.pop_front();
+ // Push the children into the queue.
+ for (CallGraphNode::const_iterator CI = N->begin(),
+ CE = N->end(); CI != CE; ++CI) {
+ if (!Visited.count(*CI))
+ BFSQueue.push_back(*CI);
+ }
+
// Skip the functions which have been processed already or previously
// inlined.
if (Visited.count(N))
@@ -377,12 +385,6 @@ void AnalysisConsumer::HandleDeclsGallGraph(const unsigned LocalTUDeclsSize) {
Visited.insert(VN);
}
Visited.insert(N);
-
- // Push the children into the queue.
- for (CallGraphNode::const_iterator CI = N->begin(),
- CE = N->end(); CI != CE; ++CI) {
- BFSQueue.push_front(*CI);
- }
}
}