[PATCH] D66381: [analyzer] Enable control dependency condition tracking by default
Kristóf Umann via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 17 10:24:55 PDT 2019
Szelethus created this revision.
Szelethus added reviewers: NoQ, xazax.hun, dcoughlin, Charusso, baloghadamsoftware, rnkovacs.
Szelethus added a project: clang.
Herald added subscribers: cfe-commits, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, szepet, whisperity.
Szelethus added a parent revision: D66131: [analyzer] Don't track the condition of foreach loops.
This patch concludes my GSoC'19 project by enabling `track-conditions` by default.
Repository:
rG LLVM Github Monorepo
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 will be (a part of a) condition}}
}
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 will be (a part of a) condition}}
}
};
@@ -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 will be (a part of a) condition}}
}
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 will be (a part of a) condition}}
}
@end
Index: clang/test/Analysis/analyzer-config.c
===================================================================
--- clang/test/Analysis/analyzer-config.c
+++ clang/test/Analysis/analyzer-config.c
@@ -86,7 +86,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.215749.patch
Type: text/x-patch
Size: 3477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190817/b393ad39/attachment-0001.bin>
More information about the cfe-commits
mailing list