diff options
author | Csaba Dabis <dabis.csaba98@gmail.com> | 2019-05-29 20:06:09 +0000 |
---|---|---|
committer | Csaba Dabis <dabis.csaba98@gmail.com> | 2019-05-29 20:06:09 +0000 |
commit | 4b0184b2d38e0c38da2c665257d516b1eb2b6175 (patch) | |
tree | a4085e391c56963141674aca736aacfd9f097454 /clang/test/Analysis/use-after-move.cpp | |
parent | 68908c9017d7c07f2a83b5d3428d5d15523a656c (diff) | |
download | bcm5719-llvm-4b0184b2d38e0c38da2c665257d516b1eb2b6175.tar.gz bcm5719-llvm-4b0184b2d38e0c38da2c665257d516b1eb2b6175.zip |
[analyzer] ConditionBRVisitor: Enhance to write out more information
Summary:
Add extra messages to the bug report to inform the user why the analyzer
`Taking true/false branch`.
Reviewers: NoQ, george.karpenkov
Reviewed By: NoQ
Subscribers: gerazo, gsd, dkrupp, whisperity, baloghadamsoftware, xazax.hun,
eraman, szepet, a.sidorin, mikhail.ramalho, Szelethus,
donat.nagy, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D53076
llvm-svn: 362020
Diffstat (limited to 'clang/test/Analysis/use-after-move.cpp')
-rw-r--r-- | clang/test/Analysis/use-after-move.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/test/Analysis/use-after-move.cpp b/clang/test/Analysis/use-after-move.cpp index ac4222bc776..e58301df8b5 100644 --- a/clang/test/Analysis/use-after-move.cpp +++ b/clang/test/Analysis/use-after-move.cpp @@ -242,10 +242,12 @@ void reinitializationTest(int i) { } { A a; - if (i == 1) { // peaceful-note 2 {{Taking false branch}} + if (i == 1) { // peaceful-note 2 {{'i' is not equal to 1}} + // peaceful-note@-1 2 {{Taking false branch}} std::move(a); } - if (i == 2) { // peaceful-note 2 {{Taking false branch}} + if (i == 2) { // peaceful-note 2 {{'i' is not equal to 2}} + // peaceful-note@-1 2 {{Taking false branch}} a = A(); a.foo(); } @@ -276,7 +278,8 @@ void reinitializationTest(int i) { // peaceful-note@-1 {{Taking false branch}} a = A(); } - if (i > 5) { // peaceful-note {{Taking true branch}} + if (i > 5) { // peaceful-note {{'i' is > 5}} + // peaceful-note@-1 {{Taking true branch}} a.foo(); // peaceful-warning {{Method called on moved-from object 'a'}} // peaceful-note@-1 {{Method called on moved-from object 'a'}} } @@ -559,7 +562,9 @@ void differentBranchesTest(int i) { // Same thing, but with a ternary operator. { A a, b; - i > 0 ? (void)(b = std::move(a)) : a.bar(); // no-warning // peaceful-note {{'?' condition is true}} + i > 0 ? (void)(b = std::move(a)) : a.bar(); // no-warning + // peaceful-note@-1 {{'i' is > 0}} + // peaceful-note@-2 {{'?' condition is true}} } // A variation on the theme above. { |