[PATCH] D66381: [analyzer] Enable control dependency condition tracking by default

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 21 20:09:25 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG0f9e530c0f4d: [analyzer] Enable control dependency condition tracking by default (authored by Szelethus).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66381/new/

https://reviews.llvm.org/D66381

Files:
  clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
  clang/test/Analysis/analyzer-config.c
  clang/test/Analysis/diagnostics/no-store-func-path-notes.m
  clang/test/Analysis/return-value-guaranteed.cpp
  clang/test/Analysis/track-control-dependency-conditions.cpp


Index: clang/test/Analysis/track-control-dependency-conditions.cpp
===================================================================
--- clang/test/Analysis/track-control-dependency-conditions.cpp
+++ clang/test/Analysis/track-control-dependency-conditions.cpp
@@ -6,6 +6,7 @@
 
 // RUN: not %clang_analyze_cc1 -verify %s \
 // RUN:   -analyzer-checker=core \
+// RUN:   -analyzer-config track-conditions=false \
 // RUN:   -analyzer-config track-conditions-debug=true \
 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-INVALID-DEBUG
 
@@ -22,6 +23,7 @@
 
 // RUN: %clang_analyze_cc1 %s -verify \
 // RUN:   -analyzer-output=text \
+// RUN:   -analyzer-config track-conditions=false \
 // RUN:   -analyzer-checker=core
 
 namespace example_1 {
Index: clang/test/Analysis/return-value-guaranteed.cpp
===================================================================
--- clang/test/Analysis/return-value-guaranteed.cpp
+++ clang/test/Analysis/return-value-guaranteed.cpp
@@ -24,6 +24,7 @@
   // class-note at -1 {{The value 0 is assigned to 'F.Field'}}
   return !MCAsmParser::Error();
   // class-note at -1 {{'MCAsmParser::Error' returns true}}
+  // class-note at -2 {{Returning zero, which participates in a condition later}}
 }
 
 bool parseFile() {
@@ -57,6 +58,7 @@
 struct MCAsmParser {
   static bool Error() {
     return false; // class-note {{'MCAsmParser::Error' returns false}}
+    // class-note at -1 {{Returning zero, which participates in a condition later}}
   }
 };
 
@@ -72,6 +74,7 @@
   return MCAsmParser::Error();
   // class-note at -1 {{Calling 'MCAsmParser::Error'}}
   // class-note at -2 {{Returning from 'MCAsmParser::Error'}}
+  // class-note at -3 {{Returning zero, which participates in a condition later}}
 }
 
 bool parseFile() {
Index: clang/test/Analysis/diagnostics/no-store-func-path-notes.m
===================================================================
--- clang/test/Analysis/diagnostics/no-store-func-path-notes.m
+++ clang/test/Analysis/diagnostics/no-store-func-path-notes.m
@@ -16,6 +16,7 @@
     return 0;
   }
   return 1; // expected-note{{Returning without writing to '*var'}}
+  // expected-note at -1{{Returning the value 1, which participates in a condition later}}
 }
 @end
 
Index: clang/test/Analysis/analyzer-config.c
===================================================================
--- clang/test/Analysis/analyzer-config.c
+++ clang/test/Analysis/analyzer-config.c
@@ -87,7 +87,7 @@
 // CHECK-NEXT: suppress-c++-stdlib = true
 // CHECK-NEXT: suppress-inlined-defensive-checks = true
 // CHECK-NEXT: suppress-null-return-paths = true
-// CHECK-NEXT: track-conditions = false
+// CHECK-NEXT: track-conditions = true
 // CHECK-NEXT: track-conditions-debug = false
 // CHECK-NEXT: unix.DynamicMemoryModeling:Optimistic = false
 // CHECK-NEXT: unroll-loops = false
Index: clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
===================================================================
--- clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
+++ clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
@@ -294,7 +294,7 @@
 ANALYZER_OPTION(bool, ShouldTrackConditions, "track-conditions",
                 "Whether to track conditions that are a control dependency of "
                 "an already tracked variable.",
-                false)
+                true)
 
 ANALYZER_OPTION(bool, ShouldTrackConditionsDebug, "track-conditions-debug",
                 "Whether to place an event at each tracked condition.",


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66381.216543.patch
Type: text/x-patch
Size: 3485 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190822/4ce0bef0/attachment-0001.bin>


More information about the cfe-commits mailing list