]> granicus.if.org Git - clang/commitdiff
[analyzer] Remove the default value arg from getChecker*Option
authorKristof Umann <kristof.umann@ericsson.com>
Fri, 17 May 2019 15:52:13 +0000 (15:52 +0000)
committerKristof Umann <kristof.umann@ericsson.com>
Fri, 17 May 2019 15:52:13 +0000 (15:52 +0000)
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

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

18 files changed:
include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
lib/StaticAnalyzer/Checkers/AnalysisOrderChecker.cpp
lib/StaticAnalyzer/Checkers/CloneChecker.cpp
lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
lib/StaticAnalyzer/Checkers/MallocChecker.cpp
lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp
lib/StaticAnalyzer/Checkers/MoveChecker.cpp
lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp
lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp
lib/StaticAnalyzer/Core/AnalyzerOptions.cpp
lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp
test/Analysis/checker-plugins.c
test/Analysis/invalid-checker-option.c
test/Analysis/plugins/CheckerOptionHandling/CheckerOptionHandling.cpp
unittests/StaticAnalyzer/AnalyzerOptionsTest.cpp

index 610b1201fda637c1d17f931b34a84a37ef9f3f0a..6db3a269a2db8aa3fd3ae6126716db632d932ccd 100644 (file)
@@ -281,18 +281,14 @@ public:
   /// Checker options are retrieved in the following format:
   /// `-analyzer-config CheckerName:OptionName=Value.
   /// @param [in] OptionName Name for option to retrieve.
-  /// @param [in] DefaultVal Default value returned if no such option was
-  /// specified.
   /// @param [in] SearchInParents If set to true and the searched option was not
   /// specified for the given checker the options for the parent packages will
   /// be searched as well. The inner packages take precedence over the outer
   /// ones.
   bool getCheckerBooleanOption(StringRef CheckerName, StringRef OptionName,
-                               bool DefaultVal,
                                bool SearchInParents = false) const;
 
   bool getCheckerBooleanOption(const ento::CheckerBase *C, StringRef OptionName,
-                               bool DefaultVal,
                                bool SearchInParents = false) const;
 
   /// Interprets an option's string value as an integer value.
@@ -305,18 +301,14 @@ public:
   /// Checker options are retrieved in the following format:
   /// `-analyzer-config CheckerName:OptionName=Value.
   /// @param [in] OptionName Name for option to retrieve.
-  /// @param [in] DefaultVal Default value returned if no such option was
-  /// specified.
   /// @param [in] SearchInParents If set to true and the searched option was not
   /// specified for the given checker the options for the parent packages will
   /// be searched as well. The inner packages take precedence over the outer
   /// ones.
   int getCheckerIntegerOption(StringRef CheckerName, StringRef OptionName,
-                              int DefaultVal,
                               bool SearchInParents = false) const;
 
   int getCheckerIntegerOption(const ento::CheckerBase *C, StringRef OptionName,
-                              int DefaultVal,
                               bool SearchInParents = false) const;
 
   /// Query an option's string value.
@@ -329,18 +321,15 @@ public:
   /// Checker options are retrieved in the following format:
   /// `-analyzer-config CheckerName:OptionName=Value.
   /// @param [in] OptionName Name for option to retrieve.
-  /// @param [in] DefaultVal Default value returned if no such option was
-  /// specified.
   /// @param [in] SearchInParents If set to true and the searched option was not
   /// specified for the given checker the options for the parent packages will
   /// be searched as well. The inner packages take precedence over the outer
   /// ones.
   StringRef getCheckerStringOption(StringRef CheckerName, StringRef OptionName,
-                                   StringRef DefaultVal,
                                    bool SearchInParents = false) const;
 
   StringRef getCheckerStringOption(const ento::CheckerBase *C,
-                                   StringRef OptionName, StringRef DefaultVal,
+                                   StringRef OptionName,
                                    bool SearchInParents = false) const;
 
   /// Retrieves and sets the UserMode. This is a high-level option,
index 05e0cd81ac8d202921568dec044e73847e2cd08e..d0def69189323be3de3809d88c98922ebe423a91 100644 (file)
@@ -44,8 +44,8 @@ class AnalysisOrderChecker
                      check::LiveSymbols> {
 
   bool isCallbackEnabled(AnalyzerOptions &Opts, StringRef CallbackName) const {
-    return Opts.getCheckerBooleanOption(this, "*", false) ||
-        Opts.getCheckerBooleanOption(this, CallbackName, false);
+    return Opts.getCheckerBooleanOption(this, "*") ||
+           Opts.getCheckerBooleanOption(this, CallbackName);
   }
 
   bool isCallbackEnabled(CheckerContext &C, StringRef CallbackName) const {
index 11a33e50bf5f5fac6dcc43afbdfd044dd9599f8c..4fc225056d4c7e03c7de3af2d3c8bd806c1bbbc6 100644 (file)
@@ -195,17 +195,17 @@ void ento::registerCloneChecker(CheckerManager &Mgr) {
   auto *Checker = Mgr.registerChecker<CloneChecker>();
 
   Checker->MinComplexity = Mgr.getAnalyzerOptions().getCheckerIntegerOption(
-      Checker, "MinimumCloneComplexity", 50);
+      Checker, "MinimumCloneComplexity");
 
   if (Checker->MinComplexity < 0)
     Mgr.reportInvalidCheckerOptionValue(
         Checker, "MinimumCloneComplexity", "a non-negative value");
 
   Checker->ReportNormalClones = Mgr.getAnalyzerOptions().getCheckerBooleanOption(
-      Checker, "ReportNormalClones", true);
+      Checker, "ReportNormalClones");
 
   Checker->IgnoredFilesPattern = Mgr.getAnalyzerOptions()
-    .getCheckerStringOption(Checker, "IgnoredFilesPattern", "");
+    .getCheckerStringOption(Checker, "IgnoredFilesPattern");
 }
 
 bool ento::shouldRegisterCloneChecker(const LangOptions &LO) {
index b67d6095690c46cf5ceb4d3340dab1c13593bd92..6927ba39c0a78e8112daa53d2a9b4f68024bd055 100644 (file)
@@ -1398,7 +1398,7 @@ void ento::registerNonLocalizedStringChecker(CheckerManager &mgr) {
       mgr.registerChecker<NonLocalizedStringChecker>();
   checker->IsAggressive =
       mgr.getAnalyzerOptions().getCheckerBooleanOption(
-          checker, "AggressiveReport", false);
+          checker, "AggressiveReport");
 }
 
 bool ento::shouldRegisterNonLocalizedStringChecker(const LangOptions &LO) {
index 50d23422c8ff60856004ffb42f70958e6d381a5b..c416b98cf4bd5afe9e2387829daf3af6d24f0a3f 100644 (file)
@@ -3098,7 +3098,7 @@ void ento::registerInnerPointerCheckerAux(CheckerManager &mgr) {
 void ento::registerDynamicMemoryModeling(CheckerManager &mgr) {
   auto *checker = mgr.registerChecker<MallocChecker>();
   checker->IsOptimistic = mgr.getAnalyzerOptions().getCheckerBooleanOption(
-                                                  checker, "Optimistic", false);
+                                                         checker, "Optimistic");
 }
 
 bool ento::shouldRegisterDynamicMemoryModeling(const LangOptions &LO) {
index 2185561fcda3f6ce889b2f3f094ac1c0d61ce7ae..270efede838589141bf354399e9a3a3980a146b9 100644 (file)
@@ -82,10 +82,10 @@ void ento::registerMmapWriteExecChecker(CheckerManager &mgr) {
       mgr.registerChecker<MmapWriteExecChecker>();
   Mwec->ProtExecOv =
     mgr.getAnalyzerOptions()
-      .getCheckerIntegerOption(Mwec, "MmapProtExec", 0x04);
+      .getCheckerIntegerOption(Mwec, "MmapProtExec");
   Mwec->ProtReadOv =
     mgr.getAnalyzerOptions()
-      .getCheckerIntegerOption(Mwec, "MmapProtRead", 0x01);
+      .getCheckerIntegerOption(Mwec, "MmapProtRead");
 }
 
 bool ento::shouldRegisterMmapWriteExecChecker(const LangOptions &LO) {
index 891a350ff23ae37c28762d1ba0f6d745e881e9b8..d8a9af78536a0fb4bb279ddfe3270e7d25a2b9b6 100644 (file)
@@ -752,8 +752,7 @@ void MoveChecker::printState(raw_ostream &Out, ProgramStateRef State,
 void ento::registerMoveChecker(CheckerManager &mgr) {
   MoveChecker *chk = mgr.registerChecker<MoveChecker>();
   chk->setAggressiveness(
-      mgr.getAnalyzerOptions().getCheckerStringOption(chk, "WarnOn",
-                                                      "KnownsAndLocals"), mgr);
+      mgr.getAnalyzerOptions().getCheckerStringOption(chk, "WarnOn"), mgr);
 }
 
 bool ento::shouldRegisterMoveChecker(const LangOptions &LO) {
index e5beb0dad2fcef425a18bc2e39936454e9c4838d..b7bf9f3db3ff690274200b181d3437f0f6d08824 100644 (file)
@@ -1208,7 +1208,7 @@ bool ento::shouldRegisterNullabilityBase(const LangOptions &LO) {
     checker->NoDiagnoseCallsToSystemHeaders =                                  \
         checker->NoDiagnoseCallsToSystemHeaders ||                             \
         mgr.getAnalyzerOptions().getCheckerBooleanOption(                      \
-                      checker, "NoDiagnoseCallsToSystemHeaders", false, true); \
+                      checker, "NoDiagnoseCallsToSystemHeaders", true);        \
   }                                                                            \
                                                                                \
   bool ento::shouldRegister##name##Checker(const LangOptions &LO) {            \
index 33119c6a18ca68177da6b32ea569ed82c1be25a7..1053424ae6faa95cccc630514e11b0abf74a9d7e 100644 (file)
@@ -346,7 +346,7 @@ void ento::registerNumberObjectConversionChecker(CheckerManager &Mgr) {
   NumberObjectConversionChecker *Chk =
       Mgr.registerChecker<NumberObjectConversionChecker>();
   Chk->Pedantic =
-      Mgr.getAnalyzerOptions().getCheckerBooleanOption(Chk, "Pedantic", false);
+      Mgr.getAnalyzerOptions().getCheckerBooleanOption(Chk, "Pedantic");
 }
 
 bool ento::shouldRegisterNumberObjectConversionChecker(const LangOptions &LO) {
index abc90986f4020cf17220b8ce4ae4a3954f0aae0c..09f2fd635b6cabf97cab776019c8e3a17b1c42ff 100644 (file)
@@ -348,7 +348,7 @@ public:
 void ento::registerPaddingChecker(CheckerManager &Mgr) {
   auto *Checker = Mgr.registerChecker<PaddingChecker>();
   Checker->AllowedPad = Mgr.getAnalyzerOptions()
-          .getCheckerIntegerOption(Checker, "AllowedPad", 24);
+          .getCheckerIntegerOption(Checker, "AllowedPad");
   if (Checker->AllowedPad < 0)
     Mgr.reportInvalidCheckerOptionValue(
         Checker, "AllowedPad", "a non-negative value");
index 187e868fba0dc654504777d6f6872232858db744..9d608c12d19be79d31815c40a594702d1de8f2aa 100644 (file)
@@ -611,18 +611,15 @@ void ento::registerUninitializedObjectChecker(CheckerManager &Mgr) {
   AnalyzerOptions &AnOpts = Mgr.getAnalyzerOptions();
   UninitObjCheckerOptions &ChOpts = Chk->Opts;
 
-  ChOpts.IsPedantic =
-      AnOpts.getCheckerBooleanOption(Chk, "Pedantic", /*DefaultVal*/ false);
+  ChOpts.IsPedantic = AnOpts.getCheckerBooleanOption(Chk, "Pedantic");
   ChOpts.ShouldConvertNotesToWarnings = AnOpts.getCheckerBooleanOption(
-      Chk, "NotesAsWarnings", /*DefaultVal*/ false);
+      Chk, "NotesAsWarnings");
   ChOpts.CheckPointeeInitialization = AnOpts.getCheckerBooleanOption(
-      Chk, "CheckPointeeInitialization", /*DefaultVal*/ false);
+      Chk, "CheckPointeeInitialization");
   ChOpts.IgnoredRecordsWithFieldPattern =
-      AnOpts.getCheckerStringOption(Chk, "IgnoreRecordsWithField",
-                                    /*DefaultVal*/ "\"\"");
+      AnOpts.getCheckerStringOption(Chk, "IgnoreRecordsWithField");
   ChOpts.IgnoreGuardedFields =
-      AnOpts.getCheckerBooleanOption(Chk, "IgnoreGuardedFields",
-                                     /*DefaultVal*/ false);
+      AnOpts.getCheckerBooleanOption(Chk, "IgnoreGuardedFields");
 
   std::string ErrorMsg;
   if (!llvm::Regex(ChOpts.IgnoredRecordsWithFieldPattern).isValid(ErrorMsg))
index c3a9ef8b56a778e8ac26224b58f9157a380c8574..762c9c1c8d7aa3db5b556660346c6d896ea8fb6c 100644 (file)
@@ -279,8 +279,7 @@ void ento::registerVirtualCallChecker(CheckerManager &mgr) {
   VirtualCallChecker *checker = mgr.registerChecker<VirtualCallChecker>();
 
   checker->IsPureOnly =
-      mgr.getAnalyzerOptions().getCheckerBooleanOption(
-                                                    checker, "PureOnly", false);
+      mgr.getAnalyzerOptions().getCheckerBooleanOption(checker, "PureOnly");
 }
 
 bool ento::shouldRegisterVirtualCallChecker(const LangOptions &LO) {
index 1ac1cc214f0cbf8def7fe20a08769e2fdcbf169a..68b2c052305b5acbdf319e66617eceee1890d876 100644 (file)
@@ -103,8 +103,7 @@ AnalyzerOptions::mayInlineCXXMemberFunction(
 
 StringRef AnalyzerOptions::getCheckerStringOption(StringRef CheckerName,
                                                   StringRef OptionName,
-                                                  StringRef DefaultVal,
-                                                  bool SearchInParents ) const {
+                                                  bool SearchInParents) const {
   assert(!CheckerName.empty() &&
          "Empty checker name! Make sure the checker object (including it's "
          "bases!) if fully initialized before calling this function!");
@@ -117,62 +116,66 @@ StringRef AnalyzerOptions::getCheckerStringOption(StringRef CheckerName,
       return StringRef(I->getValue());
     size_t Pos = CheckerName.rfind('.');
     if (Pos == StringRef::npos)
-      return DefaultVal;
+      break;
+
     CheckerName = CheckerName.substr(0, Pos);
   } while (!CheckerName.empty() && SearchInParents);
-  return DefaultVal;
+
+  llvm_unreachable("Unknown checker option! Did you call getChecker*Option "
+                   "with incorrect parameters? User input must've been "
+                   "verified by CheckerRegistry.");
+
+  return "";
 }
 
 StringRef AnalyzerOptions::getCheckerStringOption(const ento::CheckerBase *C,
                                                   StringRef OptionName,
-                                                  StringRef DefaultVal,
-                                                  bool SearchInParents ) const {
+                                                  bool SearchInParents) const {
   return getCheckerStringOption(
-             C->getTagDescription(), OptionName, DefaultVal, SearchInParents);
+                           C->getTagDescription(), OptionName, SearchInParents);
 }
 
 bool AnalyzerOptions::getCheckerBooleanOption(StringRef CheckerName,
                                               StringRef OptionName,
-                                              bool DefaultVal,
-                                              bool SearchInParents ) const {
-  // FIXME: We should emit a warning here if the value is something other than
-  // "true", "false", or the empty string (meaning the default value),
-  // but the AnalyzerOptions doesn't have access to a diagnostic engine.
-  return llvm::StringSwitch<bool>(
+                                              bool SearchInParents) const {
+  auto Ret = llvm::StringSwitch<llvm::Optional<bool>>(
       getCheckerStringOption(CheckerName, OptionName,
-                             DefaultVal ? "true" : "false",
                              SearchInParents))
       .Case("true", true)
       .Case("false", false)
-      .Default(DefaultVal);
+      .Default(None);
+
+  assert(Ret &&
+         "This option should be either 'true' or 'false', and should've been "
+         "validated by CheckerRegistry!");
+
+  return *Ret;
 }
 
 bool AnalyzerOptions::getCheckerBooleanOption(const ento::CheckerBase *C,
                                               StringRef OptionName,
-                                              bool DefaultVal,
-                                              bool SearchInParents ) const {
+                                              bool SearchInParents) const {
   return getCheckerBooleanOption(
-             C->getTagDescription(), OptionName, DefaultVal, SearchInParents);
+             C->getTagDescription(), OptionName, SearchInParents);
 }
 
 int AnalyzerOptions::getCheckerIntegerOption(StringRef CheckerName,
                                              StringRef OptionName,
-                                             int DefaultVal,
-                                             bool SearchInParents ) const {
-  int Ret = DefaultVal;
+                                             bool SearchInParents) const {
+  int Ret = 0;
   bool HasFailed = getCheckerStringOption(CheckerName, OptionName,
-                                          std::to_string(DefaultVal),
                                           SearchInParents)
                      .getAsInteger(0, Ret);
-  assert(!HasFailed && "analyzer-config option should be numeric");
+  assert(!HasFailed &&
+         "This option should be numeric, and should've been validated by "
+         "CheckerRegistry!");
   (void)HasFailed;
   return Ret;
 }
 
 int AnalyzerOptions::getCheckerIntegerOption(const ento::CheckerBase *C,
                                              StringRef OptionName,
-                                             int DefaultVal,
-                                             bool SearchInParents ) const {
+                                             bool SearchInParents) const {
   return getCheckerIntegerOption(
-             C->getTagDescription(), OptionName, DefaultVal, SearchInParents);
+                           C->getTagDescription(), OptionName, SearchInParents);
 }
index 437e4aaf1a2ed29387b84c42b677cbd8001a83b4..d41ca0a8f32f61f6e9dccbe12bf398319d61fb61 100644 (file)
@@ -324,7 +324,9 @@ static void insertAndValidate(StringRef FullName,
     return;
 
   // Insertion failed, the user supplied this package/checker option on the
-  // command line. If the supplied value is invalid, we'll emit an error.
+  // command line. If the supplied value is invalid, we'll restore the option
+  // to it's default value, and if we're in non-compatibility mode, we'll also
+  // emit an error.
 
   StringRef SuppliedValue = It.first->getValue();
 
@@ -334,6 +336,8 @@ static void insertAndValidate(StringRef FullName,
         Diags.Report(diag::err_analyzer_checker_option_invalid_input)
             << FullOption << "a boolean value";
       }
+
+      It.first->setValue(Option.DefaultValStr);
     }
     return;
   }
@@ -346,6 +350,8 @@ static void insertAndValidate(StringRef FullName,
         Diags.Report(diag::err_analyzer_checker_option_invalid_input)
             << FullOption << "an integer value";
       }
+
+      It.first->setValue(Option.DefaultValStr);
     }
     return;
   }
index 0745357e521addd25fb724e2745727eb6f9c14aa..2dbebfe29d7e0859ad0f7a79a70f53b2df7ee4ad 100644 (file)
@@ -94,3 +94,13 @@ void caller() {
 // RUN:   -analyzer-checker=example.MyChecker \
 // RUN:   -analyzer-config-compatibility-mode=true \
 // RUN:   -analyzer-config example.MyChecker:ExampleOption=example
+
+// RUN: %clang_analyze_cc1 %s \
+// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\
+// RUN:   -analyzer-checker=example.MyChecker \
+// RUN:   -analyzer-checker=debug.ConfigDumper \
+// RUN:   -analyzer-config-compatibility-mode=true \
+// RUN:   -analyzer-config example.MyChecker:ExampleOption=example \
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-CORRECTED-BOOL-VALUE
+
+// CHECK-CORRECTED-BOOL-VALUE: example.MyChecker:ExampleOption = false
index 26dfcb2d56c186821955a68a1305e50857369c92..5fb38cd3b145fdd2c5434ab7a4d5d20af4754af2 100644 (file)
 // CHECK-NON-EXISTENT-CHECKER-SAME: are associated with 'RetainOneTwoThree'
 
 
+// RUN: %clang_analyze_cc1 -verify %s \
+// RUN:   -analyzer-checker=core \
+// RUN:   -analyzer-checker=debug.ConfigDumper \
+// RUN:   -analyzer-checker=debug.AnalysisOrder \
+// RUN:   -analyzer-config-compatibility-mode=true \
+// RUN:   -analyzer-config debug.AnalysisOrder:*=yesplease \
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-CORRECTED-BOOL-VALUE
+
+// CHECK-CORRECTED-BOOL-VALUE: debug.AnalysisOrder:* = false
+//
+// RUN: %clang_analyze_cc1 -verify %s \
+// RUN:   -analyzer-checker=core \
+// RUN:   -analyzer-checker=debug.ConfigDumper \
+// RUN:   -analyzer-checker=optin.performance.Padding \
+// RUN:   -analyzer-config-compatibility-mode=true \
+// RUN:   -analyzer-config optin.performance.Padding:AllowedPad=surpriseme \
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-CORRECTED-INT-VALUE
+
+// CHECK-CORRECTED-INT-VALUE: optin.performance.Padding:AllowedPad = 24
+
+
 // Every other error should be avoidable in compatiblity mode.
 
 
index 01ddcf51534b7d40b2f5ed424c1f56c86133c5c2..c06a19df7dfe02ee163a67b06572450c70457ce8 100644 (file)
@@ -15,7 +15,7 @@ void registerMyChecker(CheckerManager &Mgr) {
   MyChecker *Checker = Mgr.registerChecker<MyChecker>();
   llvm::outs() << "Example option is set to "
                << (Mgr.getAnalyzerOptions().getCheckerBooleanOption(
-                       Checker, "ExampleOption", false)
+                       Checker, "ExampleOption")
                        ? "true"
                        : "false")
                << '\n';
index 0fb0c04b97a2f28796b6d492d4de549924073e32..cd78014eae9d61ce53f0c43d76192398c9601f46 100644 (file)
@@ -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