diff options
author | Yury Gribov <y.gribov@samsung.com> | 2016-01-11 09:38:48 +0000 |
---|---|---|
committer | Yury Gribov <y.gribov@samsung.com> | 2016-01-11 09:38:48 +0000 |
commit | 054873b0be85583b0499d12fad58566ae5398e4e (patch) | |
tree | 2ac1948344659d0dd4cf10cc645f1c6d8535cac3 /clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp | |
parent | 7ceec0b82f11f8b785ca7a34a05c5e2a4e42ccb7 (diff) | |
download | bcm5719-llvm-054873b0be85583b0499d12fad58566ae5398e4e.tar.gz bcm5719-llvm-054873b0be85583b0499d12fad58566ae5398e4e.zip |
AnalysisConsumer: use canonical decl for both lookup and store of
visited decls.
Due to redeclarations, the function may have different declarations used
in CallExpr and in the definition. However, we need to use a unique
declaration for both store and lookup in VisitedCallees. This patch
fixes issues with analysis in topological order. A simple test is
included.
Patch by Alex Sidorin!
Differential Revision: http://reviews.llvm.org/D15410
llvm-svn: 257318
Diffstat (limited to 'clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp index bf85c4ca0c6..d1446855e01 100644 --- a/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp +++ b/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp @@ -496,10 +496,11 @@ void AnalysisConsumer::HandleDeclsCallGraph(const unsigned LocalTUDeclsSize) { (Mgr->options.InliningMode == All ? nullptr : &VisitedCallees)); // Add the visited callees to the global visited set. - for (SetOfConstDecls::iterator I = VisitedCallees.begin(), - E = VisitedCallees.end(); I != E; ++I) { - Visited.insert(*I); - } + for (const Decl *Callee : VisitedCallees) + // Decls from CallGraph are already canonical. But Decls coming from + // CallExprs may be not. We should canonicalize them manually. + Visited.insert(isa<ObjCMethodDecl>(Callee) ? Callee + : Callee->getCanonicalDecl()); VisitedAsTopLevel.insert(D); } } |