]> granicus.if.org Git - clang/commitdiff
[analyzer] Even if we are not inlining a virtual call, still invalidate!
authorJordan Rose <jordan_rose@apple.com>
Wed, 15 Aug 2012 21:05:15 +0000 (21:05 +0000)
committerJordan Rose <jordan_rose@apple.com>
Wed, 15 Aug 2012 21:05:15 +0000 (21:05 +0000)
Fixes a mistake introduced in r161916.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161987 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
test/Analysis/inline.cpp

index 4e3071f73d90fe1c7f67de2e76fca30dcbe824bf..3b2e4ec8243b3377dcaaa63d217a528cc265d861 100644 (file)
@@ -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.
index 4eaed9fed13c5b23eceda957bfc9b4e5f09dd0d0..6b9a885f50f391adeb50e1de6435bcd8798ba3f0 100644 (file)
@@ -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
+    }
+  };
+}