r326518 - [analyzer] [NFC] [tests] Make test more resilient to changes in exploration strategy
George Karpenkov via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 1 16:54:05 PST 2018
Author: george.karpenkov
Date: Thu Mar 1 16:54:05 2018
New Revision: 326518
URL: http://llvm.org/viewvc/llvm-project?rev=326518&view=rev
Log:
[analyzer] [NFC] [tests] Make test more resilient to changes in exploration strategy
Modified:
cfe/trunk/test/Analysis/MisusedMovedObject.cpp
Modified: cfe/trunk/test/Analysis/MisusedMovedObject.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/MisusedMovedObject.cpp?rev=326518&r1=326517&r2=326518&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/MisusedMovedObject.cpp (original)
+++ cfe/trunk/test/Analysis/MisusedMovedObject.cpp Thu Mar 1 16:54:05 2018
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -analyze -analyzer-checker=alpha.cplusplus.MisusedMovedObject -std=c++11 -verify -analyzer-output=text %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=alpha.cplusplus.MisusedMovedObject -std=c++11 -analyzer-config exploration_strategy=dfs -verify -analyzer-output=text -DDFS=1 %s
namespace std {
@@ -474,12 +475,16 @@ void differentBranchesTest(int i) {
// A variation on the theme above.
{
A a;
+#ifdef DFS
+ a.foo() > 0 ? a.foo() : A(std::move(a)).foo(); // expected-note {{Assuming the condition is false}} expected-note {{'?' condition is false}}
+#else
a.foo() > 0 ? a.foo() : A(std::move(a)).foo(); // expected-note {{Assuming the condition is true}} expected-note {{'?' condition is true}}
+#endif
}
// Same thing, but with a switch statement.
{
A a, b;
- switch (i) { // expected-note {{Control jumps to 'case 1:' at line 483}}
+ switch (i) { // expected-note {{Control jumps to 'case 1:'}}
case 1:
b = std::move(a); // no-warning
break; // expected-note {{Execution jumps to the end of the function}}
@@ -491,7 +496,7 @@ void differentBranchesTest(int i) {
// However, if there's a fallthrough, we do warn.
{
A a, b;
- switch (i) { // expected-note {{Control jumps to 'case 1:' at line 495}}
+ switch (i) { // expected-note {{Control jumps to 'case 1:'}}
case 1:
b = std::move(a); // expected-note {{'a' became 'moved-from' here}}
case 2:
More information about the cfe-commits
mailing list