aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-08-15 21:05:15 +0000
committerJordan Rose <jordan_rose@apple.com>2012-08-15 21:05:15 +0000
commitda29ac527063fc9714547088bf841bfa30557bf0 (patch)
tree7a0fc6a54998b30c21ed908f5f7b8c4396d351b9
parentf37e4218bb40ed956f0ef1d2e5eee2b2c3aa20d2 (diff)
[analyzer] Even if we are not inlining a virtual call, still invalidate!
Fixes a mistake introduced in r161916. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161987 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp4
-rw-r--r--test/Analysis/inline.cpp27
2 files changed, 30 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp b/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
index 4e3071f73d..3b2e4ec824 100644
--- a/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
@@ -568,8 +568,10 @@ void ExprEngine::defaultEvalCall(NodeBuilder &Bldr, ExplodedNode *Pred,
}
// 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.
diff --git a/test/Analysis/inline.cpp b/test/Analysis/inline.cpp
index 4eaed9fed1..6b9a885f50 100644
--- a/test/Analysis/inline.cpp
+++ b/test/Analysis/inline.cpp
@@ -166,3 +166,30 @@ namespace PR13569_virtual {
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
+ }
+ };
+}