]> granicus.if.org Git - clang/commitdiff
[analyzer] Enable control dependency condition tracking by default
authorKristof Umann <dkszelethus@gmail.com>
Thu, 22 Aug 2019 03:08:48 +0000 (03:08 +0000)
committerKristof Umann <dkszelethus@gmail.com>
Thu, 22 Aug 2019 03:08:48 +0000 (03:08 +0000)
This patch concludes my GSoC'19 project by enabling track-conditions by default.

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

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

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

index 95dc3524ce3904ec222de17d9deed43a60b7042a..9a0225e5a0810b2b6d2a2f2b1ea5f9bc623f73d7 100644 (file)
@@ -294,7 +294,7 @@ ANALYZER_OPTION(bool, DisplayCTUProgress, "display-ctu-progress",
 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.",
index 99e1173d5d8c1d08bf0c0a8c212549487ae34925..63d22596dddf28bc09955b919645c7d663dba41f 100644 (file)
@@ -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 0136389efe6173d928747c75125ba1e848acf45d..6ef162e4ecd50a1ff6db44b2356a36379892059f 100644 (file)
@@ -16,6 +16,7 @@ extern int coin();
     return 0;
   }
   return 1; // expected-note{{Returning without writing to '*var'}}
+  // expected-note@-1{{Returning the value 1, which participates in a condition later}}
 }
 @end
 
index 367a8e5906afcdf21a29916fd84653c7a844333f..2d04a264ad813cceb0200f042cae80fb2954b201 100644 (file)
@@ -24,6 +24,7 @@ bool parseFoo(Foo &F) {
   // class-note@-1 {{The value 0 is assigned to 'F.Field'}}
   return !MCAsmParser::Error();
   // class-note@-1 {{'MCAsmParser::Error' returns true}}
+  // class-note@-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@-1 {{Returning zero, which participates in a condition later}}
   }
 };
 
@@ -72,6 +74,7 @@ bool parseFoo(Foo &F) {
   return MCAsmParser::Error();
   // class-note@-1 {{Calling 'MCAsmParser::Error'}}
   // class-note@-2 {{Returning from 'MCAsmParser::Error'}}
+  // class-note@-3 {{Returning zero, which participates in a condition later}}
 }
 
 bool parseFile() {
index bd391abdcc0c7edc983c0b505336b2d155fd3c57..737620f4c31e48b50fedbd951c30b9d917d0ced4 100644 (file)
@@ -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 {