36 lines · cpp
1// RUN: %clang_analyze_cc1 -analyzer-checker=core.builtin -verify -DCHECK_FOR_CRASH %s2// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify -analyzer-output=text %s3 4#ifdef CHECK_FOR_CRASH5// expected-no-diagnostics6#endif7 8namespace PerformTrivialCopyForUndefs {9struct A {10 int x;11};12 13struct B {14 A a;15};16 17struct C {18 B b;19};20 21void foo() {22 C c1;23 C *c2;24#ifdef CHECK_FOR_CRASH25 // If the value of variable is not defined and checkers that check undefined26 // values are not enabled, performTrivialCopy should be able to handle the27 // case with undefined values, too.28 c1.b.a = c2->b.a;29#else30 c1.b.a = c2->b.a; // expected-warning{{1st function call argument is an uninitialized value}}31 // expected-note@-1{{1st function call argument is an uninitialized value}}32#endif33}34}35 36