Home | History | Annotate | Download | only in inlining
      1 // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-config ipa=dynamic-bifurcate -verify %s
      2 
      3 void clang_analyzer_eval(bool);
      4 
      5 class A {
      6 public:
      7   virtual int get() { return 0; }
      8 };
      9 
     10 void testBifurcation(A *a) {
     11   clang_analyzer_eval(a->get() == 0); // expected-warning{{TRUE}} expected-warning{{UNKNOWN}}
     12 }
     13 
     14 void testKnown() {
     15   A a;
     16   clang_analyzer_eval(a.get() == 0); // expected-warning{{TRUE}}
     17 }
     18 
     19 
     20 namespace ReinterpretDisruptsDynamicTypeInfo {
     21   class Parent {};
     22 
     23   class Child : public Parent {
     24   public:
     25     virtual int foo() { return 42; }
     26   };
     27 
     28   void test(Parent *a) {
     29     Child *b = reinterpret_cast<Child *>(a);
     30     if (!b) return;
     31     clang_analyzer_eval(b->foo() == 42); // expected-warning{{UNKNOWN}}
     32   }
     33 }
     34