]> granicus.if.org Git - clang/commitdiff
[analyzer] Switch the default exploration strategy to priority queue based on coverage
authorGeorge Karpenkov <ekarpenkov@apple.com>
Tue, 27 Feb 2018 01:31:56 +0000 (01:31 +0000)
committerGeorge Karpenkov <ekarpenkov@apple.com>
Tue, 27 Feb 2018 01:31:56 +0000 (01:31 +0000)
After the investigation it seems safe to flip the switch.

Differential Revision: https://reviews.llvm.org/D43782

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326157 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
test/Analysis/MisusedMovedObject.cpp
test/Analysis/analyzer-config.c
test/Analysis/analyzer-config.cpp
test/Analysis/loop-unrolling.cpp

index c01e531c49c7c81b4361946bbefbbc5f7e1a6a90..dcc5de42d5c1d751bb65433e1b4a01beb9edca67 100644 (file)
@@ -60,7 +60,7 @@ AnalyzerOptions::getExplorationStrategy() {
   if (ExplorationStrategy == ExplorationStrategyKind::NotSet) {
     StringRef StratStr =
         Config
-            .insert(std::make_pair("exploration_strategy", "dfs"))
+            .insert(std::make_pair("exploration_strategy", "unexplored_first_queue"))
             .first->second;
     ExplorationStrategy =
         llvm::StringSwitch<ExplorationStrategyKind>(StratStr)
index 132a65de104ea2af17960dff6c3b12f88f581094..c566d42eb4c6d70847e060b7c513c6773d7a8968 100644 (file)
@@ -474,7 +474,7 @@ void differentBranchesTest(int i) {
   // A variation on the theme above.
   {
     A a;
-    a.foo() > 0 ? a.foo() : A(std::move(a)).foo(); // expected-note {{Assuming the condition is false}} expected-note {{'?' condition is false}}
+    a.foo() > 0 ? a.foo() : A(std::move(a)).foo(); // expected-note {{Assuming the condition is true}} expected-note {{'?' condition is true}}
   }
   // Same thing, but with a switch statement.
   {
index 78868a562552fd5815cbebeff766b3a7c55f97ed..13c4870ac399b085020d85b51e5610ff9d9aa160 100644 (file)
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 %s -o /dev/null -analyzer-checker=core,osx.cocoa,debug.ConfigDumper -analyzer-max-loop 34 > %t 2>&1
-// RUN: FileCheck --input-file=%t %s
+// RUN: FileCheck --input-file=%t %s --match-full-lines
 
 void bar() {}
 void foo() {
@@ -17,7 +17,7 @@ void foo() {
 // CHECK-NEXT: cfg-loopexit = false
 // CHECK-NEXT: cfg-rich-constructors = true
 // CHECK-NEXT: cfg-temporary-dtors = false
-// CHECK-NEXT: exploration_strategy = dfs
+// CHECK-NEXT: exploration_strategy = unexplored_first_queue
 // CHECK-NEXT: faux-bodies = true
 // CHECK-NEXT: graph-trim-interval = 1000
 // CHECK-NEXT: inline-lambdas = true
index 9b949744efdd408a36ff83d1dbe96cf2f8bd6296..46336ffc6675495f6f47edb2e20beea1fde7579a 100644 (file)
@@ -1,5 +1,5 @@
 // RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin10 %s -o /dev/null -analyzer-checker=core,osx.cocoa,debug.ConfigDumper -analyzer-max-loop 34 > %t 2>&1
-// RUN: FileCheck --input-file=%t %s
+// RUN: FileCheck --input-file=%t %s --match-full-lines
 
 void bar() {}
 void foo() {
@@ -30,7 +30,7 @@ public:
 // CHECK-NEXT: cfg-loopexit = false
 // CHECK-NEXT: cfg-rich-constructors = true
 // CHECK-NEXT: cfg-temporary-dtors = false
-// CHECK-NEXT: exploration_strategy = dfs
+// CHECK-NEXT: exploration_strategy = unexplored_first_queue
 // CHECK-NEXT: faux-bodies = true
 // CHECK-NEXT: graph-trim-interval = 1000
 // CHECK-NEXT: inline-lambdas = true
index 844d1f18ea578b4c6e34da2f18e543f3cc56350c..cd5e9ef8278c8b3b1206956440d8b37d2ddf5262 100644 (file)
@@ -1,4 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config unroll-loops=true,cfg-loopexit=true -verify -std=c++11 %s
+// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config unroll-loops=true,cfg-loopexit=true,exploration_strategy=dfs -verify -std=c++11 -DDFS=1 %s
 
 void clang_analyzer_numTimesReached();
 void clang_analyzer_warnIfReached();
@@ -234,7 +235,11 @@ int simple_known_bound_loop() {
 
 int simple_unknown_bound_loop() {
   for (int i = 2; i < getNum(); i++) {
+#ifdef DFS
     clang_analyzer_numTimesReached(); // expected-warning {{10}}
+#else
+    clang_analyzer_numTimesReached(); // expected-warning {{13}}
+#endif
   }
   return 0;
 }