diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-09-12 21:48:13 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-09-12 21:48:13 +0000 |
commit | 99c6c2b4e241429647c67cb8a67250d4b9234c69 (patch) | |
tree | ac3110d295d02911ec8fe9f4ab13a48fd9f5039d /clang/lib/StaticAnalyzer/Core/CallEvent.cpp | |
parent | abb87d485799ef3a185621e16b0ab163db08b7a6 (diff) | |
download | bcm5719-llvm-99c6c2b4e241429647c67cb8a67250d4b9234c69.tar.gz bcm5719-llvm-99c6c2b4e241429647c67cb8a67250d4b9234c69.zip |
Revert "[analyzer] Use the static type for a virtual call if the dynamic type is worse."
Using the static type may be inconsistent with later calls. We should just
report that there is no inlining definition available if the static type is
better than the dynamic type. See next commit.
This reverts r163644 / 19d5886d1704e24282c86217b09d5c6d35ba604d.
llvm-svn: 163744
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/CallEvent.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp index 0f71a76842e..09ba21173ba 100644 --- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp +++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp @@ -433,21 +433,14 @@ RuntimeDefinition CXXInstanceCall::getRuntimeDefinition() const { if (!RD || !RD->hasDefinition()) return RuntimeDefinition(); - const CXXMethodDecl *Result; - if (MD->getParent()->isDerivedFrom(RD)) { - // If our static type info is better than our dynamic type info, don't - // bother doing a search. Just use the static method. - Result = MD; - } else { - // Otherwise, find the decl for the method in the dynamic class. - Result = MD->getCorrespondingMethodInClass(RD, true); - } - + // Find the decl for this method in that class. + const CXXMethodDecl *Result = MD->getCorrespondingMethodInClass(RD, true); if (!Result) { // We might not even get the original statically-resolved method due to // some particularly nasty casting (e.g. casts to sister classes). // However, we should at least be able to search up and down our own class // hierarchy, and some real bugs have been caught by checking this. + assert(!MD->getParent()->isDerivedFrom(RD) && "Bad DynamicTypeInfo"); assert(!RD->isDerivedFrom(MD->getParent()) && "Couldn't find known method"); return RuntimeDefinition(); } |