r369616 - [analyzer] Enable control dependency condition tracking by default

Kristof Umann via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 21 20:08:48 PDT 2019


Author: szelethus
Date: Wed Aug 21 20:08:48 2019
New Revision: 369616

URL: http://llvm.org/viewvc/llvm-project?rev=369616&view=rev
Log:
[analyzer] Enable control dependency condition tracking by default

This patch concludes my GSoC'19 project by enabling track-conditions by default.

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

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

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def?rev=369616&r1=369615&r2=369616&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def Wed Aug 21 20:08:48 2019
@@ -294,7 +294,7 @@ ANALYZER_OPTION(bool, DisplayCTUProgress
 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.",

Modified: cfe/trunk/test/Analysis/analyzer-config.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/analyzer-config.c?rev=369616&r1=369615&r2=369616&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/analyzer-config.c (original)
+++ cfe/trunk/test/Analysis/analyzer-config.c Wed Aug 21 20:08:48 2019
@@ -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

Modified: cfe/trunk/test/Analysis/diagnostics/no-store-func-path-notes.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/no-store-func-path-notes.m?rev=369616&r1=369615&r2=369616&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/diagnostics/no-store-func-path-notes.m (original)
+++ cfe/trunk/test/Analysis/diagnostics/no-store-func-path-notes.m Wed Aug 21 20:08:48 2019
@@ -16,6 +16,7 @@ extern int coin();
     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
 

Modified: cfe/trunk/test/Analysis/return-value-guaranteed.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/return-value-guaranteed.cpp?rev=369616&r1=369615&r2=369616&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/return-value-guaranteed.cpp (original)
+++ cfe/trunk/test/Analysis/return-value-guaranteed.cpp Wed Aug 21 20:08:48 2019
@@ -24,6 +24,7 @@ bool parseFoo(Foo &F) {
   // 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 @@ namespace test_break {
 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 @@ bool parseFoo(Foo &F) {
   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() {

Modified: cfe/trunk/test/Analysis/track-control-dependency-conditions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/track-control-dependency-conditions.cpp?rev=369616&r1=369615&r2=369616&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/track-control-dependency-conditions.cpp (original)
+++ cfe/trunk/test/Analysis/track-control-dependency-conditions.cpp Wed Aug 21 20:08:48 2019
@@ -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 {




More information about the cfe-commits mailing list