brintos

brintos / llvm-project-archived public Read only

0
0
Text · 837 B · fbcb72d Raw
28 lines · cpp
1// RUN: %clang_analyze_cc1 -verify %s \2// RUN:   -analyzer-checker=core \3// RUN:   -analyzer-config widen-loops=true \4// RUN:   -analyzer-config track-conditions=false \5// RUN:   -analyzer-max-loop 2 -analyzer-output=text6 7namespace pr43102 {8class A {9public:10  void m_fn1();11};12bool g;13void fn1() {14  A a;15  A *b = &a;16 17  for (;;) { // expected-note{{Loop condition is true.  Entering loop body}}18             // expected-note@-1{{Loop condition is true.  Entering loop body}}19             // expected-note@-2{{Value assigned to 'b'}}20             // no crash during bug report construction21 22    g = !b;     // expected-note{{Assuming 'b' is null}}23    b->m_fn1(); // expected-warning{{Called C++ object pointer is null}}24                // expected-note@-1{{Called C++ object pointer is null}}25  }26}27} // end of namespace pr4310228