summaryrefslogtreecommitdiffstats
path: root/clang/unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp
diff options
context:
space:
mode:
authorKristof Umann <kristof.umann@ericsson.com>2019-05-17 15:52:13 +0000
committerKristof Umann <kristof.umann@ericsson.com>2019-05-17 15:52:13 +0000
commit83cc1b35d1871847bdb959d613abcb8bce15ffb2 (patch)
treecb59337e488501c5e4dcafdea0248660ec977ca3 /clang/unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp
parent3a02b12439f8ac9e459a34ad4d02d5bcf1a5540b (diff)
downloadbcm5719-llvm-83cc1b35d1871847bdb959d613abcb8bce15ffb2.tar.gz
bcm5719-llvm-83cc1b35d1871847bdb959d613abcb8bce15ffb2.zip
[analyzer] Remove the default value arg from getChecker*Option
Since D57922, the config table contains every checker option, and it's default value, so having it as an argument for getChecker*Option is redundant. By the time any of the getChecker*Option function is called, we verified the value in CheckerRegistry (after D57860), so we can confidently assert here, as any irregularities detected at this point must be a programmer error. However, in compatibility mode, verification won't happen, so the default value must be restored. This implies something else, other than adding removing one more potential point of failure -- debug.ConfigDumper will always contain valid values for checker/package options! Differential Revision: https://reviews.llvm.org/D59195 llvm-svn: 361042
Diffstat (limited to 'clang/unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp')
-rw-r--r--clang/unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp31
1 files changed, 14 insertions, 17 deletions
diff --git a/clang/unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp b/clang/unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp
index 0fb0c04b97a..cd78014eae9 100644
--- a/clang/unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp
+++ b/clang/unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp
@@ -51,25 +51,24 @@ TEST(StaticAnalyzerOptions, SearchInParentPackageTests) {
// CheckerTwo one has Option specified as true. It should read true regardless
// of search mode.
CheckerOneMock CheckerOne;
- EXPECT_TRUE(Opts.getCheckerBooleanOption(&CheckerOne, "Option", false));
+ EXPECT_TRUE(Opts.getCheckerBooleanOption(&CheckerOne, "Option"));
// The package option is overridden with a checker option.
- EXPECT_TRUE(Opts.getCheckerBooleanOption(&CheckerOne, "Option", false,
- true));
+ EXPECT_TRUE(Opts.getCheckerBooleanOption(&CheckerOne, "Option", true));
// The Outer package option is overridden by the Inner package option. No
// package option is specified.
- EXPECT_TRUE(Opts.getCheckerBooleanOption(&CheckerOne, "Option2", false,
- true));
- // No package option is specified and search in packages is turned off. The
- // default value should be returned.
- EXPECT_FALSE(Opts.getCheckerBooleanOption(&CheckerOne, "Option2", false));
EXPECT_TRUE(Opts.getCheckerBooleanOption(&CheckerOne, "Option2", true));
+ // No package option is specified and search in packages is turned off. We
+ // should assert here, but we can't test that.
+ //Opts.getCheckerBooleanOption(&CheckerOne, "Option2");
+ //Opts.getCheckerBooleanOption(&CheckerOne, "Option2");
- // Checker true has no option specified. It should get the default value when
- // search in parents turned off and false when search in parents turned on.
+ // Checker true has no option specified. It should get false when search in
+ // parents turned on.
CheckerTwoMock CheckerTwo;
- EXPECT_FALSE(Opts.getCheckerBooleanOption(&CheckerTwo, "Option", false));
- EXPECT_TRUE(Opts.getCheckerBooleanOption(&CheckerTwo, "Option", true));
- EXPECT_FALSE(Opts.getCheckerBooleanOption(&CheckerTwo, "Option", true, true));
+ EXPECT_FALSE(Opts.getCheckerBooleanOption(&CheckerTwo, "Option", true));
+ // In any other case, we should assert, that we cannot test unfortunately.
+ //Opts.getCheckerBooleanOption(&CheckerTwo, "Option");
+ //Opts.getCheckerBooleanOption(&CheckerTwo, "Option");
}
TEST(StaticAnalyzerOptions, StringOptions) {
@@ -84,16 +83,14 @@ TEST(StaticAnalyzerOptions, StringOptions) {
CheckerOneMock CheckerOne;
EXPECT_TRUE("StringValue" ==
- Opts.getCheckerStringOption(&CheckerOne, "Option", "DefaultValue"));
- EXPECT_TRUE("DefaultValue" ==
- Opts.getCheckerStringOption(&CheckerOne, "Option2", "DefaultValue"));
+ Opts.getCheckerStringOption(&CheckerOne, "Option"));
}
TEST(StaticAnalyzerOptions, SubCheckerOptions) {
AnalyzerOptions Opts;
Opts.Config["Outer.Inner.CheckerOne:Option"] = "StringValue";
EXPECT_TRUE("StringValue" == Opts.getCheckerStringOption(
- "Outer.Inner.CheckerOne", "Option", "DefaultValue"));
+ "Outer.Inner.CheckerOne", "Option"));
}
} // end namespace ento
OpenPOWER on IntegriCloud