diff options
Diffstat (limited to 'clang/test/Analysis/diagnostics/no-store-func-path-notes.cpp')
-rw-r--r-- | clang/test/Analysis/diagnostics/no-store-func-path-notes.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/clang/test/Analysis/diagnostics/no-store-func-path-notes.cpp b/clang/test/Analysis/diagnostics/no-store-func-path-notes.cpp index b96dc4cf2a8..17ec96ae5b7 100644 --- a/clang/test/Analysis/diagnostics/no-store-func-path-notes.cpp +++ b/clang/test/Analysis/diagnostics/no-store-func-path-notes.cpp @@ -97,6 +97,14 @@ struct C { int x; int y; C(int pX, int pY) : x(pX) {} // expected-note{{Returning without writing to 'this->y'}} + + C(int pX, int pY, bool Flag) { + x = pX; + if (Flag) // expected-note{{Assuming 'Flag' is not equal to 0}} + // expected-note@-1{{Taking true branch}} + return; // expected-note{{Returning without writing to 'this->y'}} + y = pY; + } }; int use_constructor() { @@ -106,6 +114,15 @@ int use_constructor() { // expected-warning@-1{{Undefined or garbage value returned to caller}} } +int coin(); + +int use_other_constructor() { + C c(0, 0, coin()); // expected-note{{Calling constructor for 'C'}} + // expected-note@-1{{Returning from constructor for 'C'}} + return c.y; // expected-note{{Undefined or garbage value returned to caller}} + // expected-warning@-1{{Undefined or garbage value returned to caller}} +} + struct D { void initialize(int *); }; @@ -122,8 +139,6 @@ int use_d_initializer(D* d) { // expected-warning@-1{{Undefined or garbage value returned to caller}} } -int coin(); - struct S2 { int x; }; |