[cfe-commits] r161987 - in /cfe/trunk: lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp test/Analysis/inline.cpp
Jordan Rose
jordan_rose at apple.com
Wed Aug 15 14:05:15 PDT 2012
Author: jrose
Date: Wed Aug 15 16:05:15 2012
New Revision: 161987
URL: http://llvm.org/viewvc/llvm-project?rev=161987&view=rev
Log:
[analyzer] Even if we are not inlining a virtual call, still invalidate!
Fixes a mistake introduced in r161916.
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
cfe/trunk/test/Analysis/inline.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp?rev=161987&r1=161986&r2=161987&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp Wed Aug 15 16:05:15 2012
@@ -568,8 +568,10 @@
}
// Don't inline if we're not in any dynamic dispatch mode.
- if (getAnalysisManager().IPAMode != DynamicDispatch)
+ if (getAnalysisManager().IPAMode != DynamicDispatch) {
+ conservativeEvalCall(*Call, Bldr, Pred, State);
return;
+ }
}
// We are not bifurcating and we do have a Decl, so just inline.
Modified: cfe/trunk/test/Analysis/inline.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/inline.cpp?rev=161987&r1=161986&r2=161987&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/inline.cpp (original)
+++ cfe/trunk/test/Analysis/inline.cpp Wed Aug 15 16:05:15 2012
@@ -166,3 +166,30 @@
x.interface();
}
}
+
+namespace Invalidation {
+ struct X {
+ void touch(int &x) const {
+ x = 0;
+ }
+
+ void touch2(int &x) const;
+
+ virtual void touchV(int &x) const {
+ x = 0;
+ }
+
+ virtual void touchV2(int &x) const;
+
+ int test() const {
+ // We were accidentally not invalidating under -analyzer-ipa=inlining
+ // at one point for virtual methods with visible definitions.
+ int a, b, c, d;
+ touch(a);
+ touch2(b);
+ touchV(c);
+ touchV2(d);
+ return a + b + c + d; // no-warning
+ }
+ };
+}
More information about the cfe-commits
mailing list