[cfe-commits] r163746 - /cfe/trunk/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp

Jordan Rose jordan_rose at apple.com
Wed Sep 12 14:50:56 PDT 2012


Author: jrose
Date: Wed Sep 12 16:50:56 2012
New Revision: 163746

URL: http://llvm.org/viewvc/llvm-project?rev=163746&view=rev
Log:
[analyzer] Re-add reinterpret_cast virtual call test case from r163644.

We mostly just don't want to crash analyzing this test case; it's likely
the code found here will actually crash if compiled and run.

Modified:
    cfe/trunk/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp

Modified: cfe/trunk/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp?rev=163746&r1=163745&r2=163746&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp (original)
+++ cfe/trunk/test/Analysis/inlining/dyn-dispatch-bifurcate.cpp Wed Sep 12 16:50:56 2012
@@ -15,3 +15,19 @@
   A a;
   clang_analyzer_eval(a.get() == 0); // expected-warning{{TRUE}}
 }
+
+
+namespace ReinterpretDisruptsDynamicTypeInfo {
+  class Parent {};
+
+  class Child : public Parent {
+  public:
+    virtual int foo() { return 42; }
+  };
+
+  void test(Parent *a) {
+    Child *b = reinterpret_cast<Child *>(a);
+    if (!b) return;
+    clang_analyzer_eval(b->foo() == 42); // expected-warning{{UNKNOWN}}
+  }
+}





More information about the cfe-commits mailing list