<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0"><a href="http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick" class="OWAAutoLink" id="LPlnk83113" previewremoved="true">http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick</a> seems to be doing fine now, <a href="http://lab.llvm.org:8011/builders/clang-ppc64be-linux" class="OWAAutoLink" id="LPlnk934533" previewremoved="true">http://lab.llvm.org:8011/builders/clang-ppc64be-linux</a> seems
 to crash on files totally unrelated to mine.</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Kristof Umann<br>
<b>Sent:</b> 17 May 2019 15:59:28<br>
<b>To:</b> Nico Weber<br>
<b>Cc:</b> cfe-commits<br>
<b>Subject:</b> Re: r361011 - [analyzer] Validate checker option names and values</font>
<div> </div>
</div>
<style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0; margin-bottom:0">I'll take a look.</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Nico Weber <thakis@chromium.org><br>
<b>Sent:</b> 17 May 2019 15:09:18<br>
<b>To:</b> Kristof Umann<br>
<b>Cc:</b> cfe-commits<br>
<b>Subject:</b> Re: r361011 - [analyzer] Validate checker option names and values</font>
<div> </div>
</div>
<div>
<div dir="ltr">It looks like this change is making gcc-7 crash on these (and other <a href="http://lab.llvm.org:8011/console">http://lab.llvm.org:8011/console</a>) bots:
<div><br>
</div>
<div><a href="http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/18639">http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/18639</a><br>
</div>
<div><a href="http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/33837/">http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/33837/</a><br>
</div>
<div><br>
</div>
<div>[100/212] Building CXX object tools/clang/unittests/AST/CMakeFiles/ASTTests.dir/ASTImporterTest.cpp.o<br>
FAILED: tools/clang/unittests/AST/CMakeFiles/ASTTests.dir/ASTImporterTest.cpp.o <br>
...</div>
<div>g++-7: internal compiler error: Killed (program cc1plus)<br>
Please submit a full bug report,<br>
with preprocessed source if appropriate.<br>
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.<br>
[101/212] Building CXX object tools/clang/unittests/ASTMatchers/CMakeFiles/ASTMatchersTests.dir/ASTMatchersTraversalTest.cpp.o<br>
FAILED: tools/clang/unittests/ASTMatchers/CMakeFiles/ASTMatchersTests.dir/ASTMatchersTraversalTest.cpp.o
<br>
...</div>
<div>g++-7: internal compiler error: Killed (program cc1plus)<br>
Please submit a full bug report,<br>
with preprocessed source if appropriate.<br>
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.<br>
[102/212] Building CXX object tools/clang/unittests/ASTMatchers/CMakeFiles/ASTMatchersTests.dir/ASTMatchersNarrowingTest.cpp.o<br>
FAILED: tools/clang/unittests/ASTMatchers/CMakeFiles/ASTMatchersTests.dir/ASTMatchersNarrowingTest.cpp.o
<br>
...</div>
<div>g++-7: internal compiler error: Killed (program cc1plus)<br>
Please submit a full bug report,<br>
with preprocessed source if appropriate.<br>
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.<br>
[103/212] Building CXX object tools/clang/unittests/ASTMatchers/CMakeFiles/ASTMatchersTests.dir/ASTMatchersNodeTest.cpp.o<br>
FAILED: tools/clang/unittests/ASTMatchers/CMakeFiles/ASTMatchersTests.dir/ASTMatchersNodeTest.cpp.o
<br>
...</div>
<div>g++-7: internal compiler error: Killed (program cc1plus)<br>
Please submit a full bug report,<br>
with preprocessed source if appropriate.<br>
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.<br>
[104/212] Building CXX object tools/clang/unittests/Tooling/CMakeFiles/ToolingTests.dir/CommentHandlerTest.cpp.o<br>
FAILED: tools/clang/unittests/Tooling/CMakeFiles/ToolingTests.dir/CommentHandlerTest.cpp.o
<br>
...</div>
<div>g++-7: internal compiler error: Killed (program cc1plus)<br>
Please submit a full bug report,<br>
with preprocessed source if appropriate.<br>
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.<br>
[105/212] Building CXX object tools/clang/unittests/Tooling/CMakeFiles/ToolingTests.dir/ExecutionTest.cpp.o<br>
FAILED: tools/clang/unittests/Tooling/CMakeFiles/ToolingTests.dir/ExecutionTest.cpp.o
<br>
...</div>
<div>g++-7: internal compiler error: Killed (program cc1plus)<br>
Please submit a full bug report,<br>
with preprocessed source if appropriate.<br>
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.<br>
[106/212] Building CXX object tools/clang/unittests/AST/CMakeFiles/ASTTests.dir/ASTImporterVisibilityTest.cpp.o<br>
FAILED: tools/clang/unittests/AST/CMakeFiles/ASTTests.dir/ASTImporterVisibilityTest.cpp.o
<br>
...</div>
<div>g++-7: internal compiler error: Killed (program cc1plus)<br>
Please submit a full bug report,<br>
with preprocessed source if appropriate.<br>
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.<br>
</div>
</div>
<br>
<div class="x_x_gmail_quote">
<div dir="ltr" class="x_x_gmail_attr"><strong>From: </strong>Kristof Umann via cfe-commits
<span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>></span><br>
<strong>Date: </strong>Fri, May 17, 2019 at 5:49 AM<br>
<strong>To: </strong><<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>><br>
<br>
</div>
<blockquote class="x_x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
Author: szelethus<br>
Date: Fri May 17 02:51:59 2019<br>
New Revision: 361011<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=361011&view=rev" rel="noreferrer" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=361011&view=rev</a><br>
Log:<br>
[analyzer] Validate checker option names and values<br>
<br>
Validate whether the option exists, and also whether the supplied value is of<br>
the correct type. With this patch, invoking the analyzer should be, at least<br>
in the frontend mode, a lot safer.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D57860" rel="noreferrer" target="_blank">
https://reviews.llvm.org/D57860</a><br>
<br>
Modified:<br>
    cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td<br>
    cfe/trunk/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h<br>
    cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp<br>
    cfe/trunk/test/Analysis/checker-plugins.c<br>
    cfe/trunk/test/Analysis/invalid-checker-option.c<br>
<br>
Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=361011&r1=361010&r2=361011&view=diff" rel="noreferrer" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=361011&r1=361010&r2=361011&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Fri May 17 02:51:59 2019<br>
@@ -307,6 +307,8 @@ def err_analyzer_config_multiple_values<br>
 def err_analyzer_config_invalid_input : Error<<br>
   "invalid input for analyzer-config option '%0', that expects %1 value">;<br>
 def err_analyzer_config_unknown : Error<"unknown analyzer-config '%0'">;<br>
+def err_analyzer_checker_option_unknown : Error<<br>
+  "checker '%0' has no option called '%1'">;<br>
 def err_analyzer_checker_option_invalid_input : Error<<br>
   "invalid input for checker option '%0', that expects %1">;<br>
<br>
<br>
Modified: cfe/trunk/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h?rev=361011&r1=361010&r2=361011&view=diff" rel="noreferrer" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h?rev=361011&r1=361010&r2=361011&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h (original)<br>
+++ cfe/trunk/include/clang/StaticAnalyzer/Frontend/CheckerRegistry.h Fri May 17 02:51:59 2019<br>
@@ -107,6 +107,17 @@ public:<br>
       assert((OptionType == "bool" || OptionType == "string" ||<br>
               OptionType == "int") &&<br>
              "Unknown command line option type!");<br>
+<br>
+      assert((OptionType != "bool" ||<br>
+              (DefaultValStr == "true" || DefaultValStr == "false")) &&<br>
+             "Invalid value for boolean command line option! Maybe incorrect "<br>
+             "parameters to the addCheckerOption or addPackageOption method?");<br>
+<br>
+      int Tmp;<br>
+      assert((OptionType != "int" || !DefaultValStr.getAsInteger(0, Tmp)) &&<br>
+             "Invalid value for integer command line option! Maybe incorrect "<br>
+             "parameters to the addCheckerOption or addPackageOption method?");<br>
+      (void)Tmp;<br>
     }<br>
   };<br>
<br>
@@ -150,6 +161,12 @@ public:<br>
       return State == StateFromCmdLine::State_Disabled && ShouldRegister(LO);<br>
     }<br>
<br>
+    // Since each checker must have a different full name, we can identify<br>
+    // CheckerInfo objects by them.<br>
+    bool operator==(const CheckerInfo &Rhs) const {<br>
+      return FullName == Rhs.FullName;<br>
+    }<br>
+<br>
     CheckerInfo(InitializationFunction Fn, ShouldRegisterFunction sfn,<br>
                 StringRef Name, StringRef Desc, StringRef DocsUri,<br>
                 bool IsHidden)<br>
<br>
Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp?rev=361011&r1=361010&r2=361011&view=diff" rel="noreferrer" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp?rev=361011&r1=361010&r2=361011&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp (original)<br>
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp Fri May 17 02:51:59 2019<br>
@@ -9,6 +9,7 @@<br>
 #include "clang/StaticAnalyzer/Frontend/CheckerRegistry.h"<br>
 #include "clang/Basic/Diagnostic.h"<br>
 #include "clang/Basic/LLVM.h"<br>
+#include "clang/Driver/DriverDiagnostic.h"<br>
 #include "clang/Frontend/FrontendDiagnostic.h"<br>
 #include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"<br>
 #include "clang/StaticAnalyzer/Core/AnalyzerOptions.h"<br>
@@ -306,18 +307,61 @@ void CheckerRegistry::addDependency(Stri<br>
   Dependencies.emplace_back(FullName, Dependency);<br>
 }<br>
<br>
+/// Insert the checker/package option to AnalyzerOptions' config table, and<br>
+/// validate it, if the user supplied it on the command line.<br>
+static void insertAndValidate(StringRef FullName,<br>
+                              const CheckerRegistry::CmdLineOption &Option,<br>
+                              AnalyzerOptions &AnOpts,<br>
+                              DiagnosticsEngine &Diags) {<br>
+<br>
+  std::string FullOption = (FullName + ":" + Option.OptionName).str();<br>
+<br>
+  auto It = AnOpts.Config.insert({FullOption, Option.DefaultValStr});<br>
+<br>
+  // Insertation was successful -- CmdLineOption's constructor will validate<br>
+  // whether values received from plugins or TableGen files are correct.<br>
+  if (It.second)<br>
+    return;<br>
+<br>
+  // Insertion failed, the user supplied this package/checker option on the<br>
+  // command line. If the supplied value is invalid, we'll emit an error.<br>
+<br>
+  StringRef SuppliedValue = It.first->getValue();<br>
+<br>
+  if (Option.OptionType == "bool") {<br>
+    if (SuppliedValue != "true" && SuppliedValue != "false") {<br>
+      if (AnOpts.ShouldEmitErrorsOnInvalidConfigValue) {<br>
+        Diags.Report(diag::err_analyzer_checker_option_invalid_input)<br>
+            << FullOption << "a boolean value";<br>
+      }<br>
+    }<br>
+    return;<br>
+  }<br>
+<br>
+  if (Option.OptionType == "int") {<br>
+    int Tmp;<br>
+    bool HasFailed = SuppliedValue.getAsInteger(0, Tmp);<br>
+    if (HasFailed) {<br>
+      if (AnOpts.ShouldEmitErrorsOnInvalidConfigValue) {<br>
+        Diags.Report(diag::err_analyzer_checker_option_invalid_input)<br>
+            << FullOption << "an integer value";<br>
+      }<br>
+    }<br>
+    return;<br>
+  }<br>
+}<br>
+<br>
 template <class T><br>
 static void<br>
 insertOptionToCollection(StringRef FullName, T &Collection,<br>
                          const CheckerRegistry::CmdLineOption &Option,<br>
-                         AnalyzerOptions &AnOpts) {<br>
+                         AnalyzerOptions &AnOpts, DiagnosticsEngine &Diags) {<br>
   auto It = binaryFind(Collection, FullName);<br>
   assert(It != Collection.end() &&<br>
          "Failed to find the checker while attempting to add a command line "<br>
          "option to it!");<br>
<br>
-  AnOpts.Config.insert(<br>
-      {(FullName + ":" + Option.OptionName).str(), Option.DefaultValStr});<br>
+  insertAndValidate(FullName, Option, AnOpts, Diags);<br>
<br>
   It->CmdLineOptions.emplace_back(Option);<br>
 }<br>
@@ -326,14 +370,14 @@ void CheckerRegistry::resolveCheckerAndP<br>
   for (const std::pair<StringRef, CmdLineOption> &CheckerOptEntry :<br>
        CheckerOptions) {<br>
     insertOptionToCollection(CheckerOptEntry.first, Checkers,<br>
-                             CheckerOptEntry.second, AnOpts);<br>
+                             CheckerOptEntry.second, AnOpts, Diags);<br>
   }<br>
   CheckerOptions.clear();<br>
<br>
   for (const std::pair<StringRef, CmdLineOption> &PackageOptEntry :<br>
        PackageOptions) {<br>
-    insertOptionToCollection(PackageOptEntry.first, Checkers,<br>
-                             PackageOptEntry.second, AnOpts);<br>
+    insertOptionToCollection(PackageOptEntry.first, Packages,<br>
+                             PackageOptEntry.second, AnOpts, Diags);<br>
   }<br>
   PackageOptions.clear();<br>
 }<br>
@@ -388,23 +432,62 @@ void CheckerRegistry::initializeManager(<br>
   }<br>
 }<br>
<br>
+static void<br>
+isOptionContainedIn(const CheckerRegistry::CmdLineOptionList &OptionList,<br>
+                    StringRef SuppliedChecker, StringRef SuppliedOption,<br>
+                    const AnalyzerOptions &AnOpts, DiagnosticsEngine &Diags) {<br>
+<br>
+  if (!AnOpts.ShouldEmitErrorsOnInvalidConfigValue)<br>
+    return;<br>
+<br>
+  using CmdLineOption = CheckerRegistry::CmdLineOption;<br>
+<br>
+  auto SameOptName = [SuppliedOption](const CmdLineOption &Opt) {<br>
+    return Opt.OptionName == SuppliedOption;<br>
+  };<br>
+<br>
+  auto OptionIt = llvm::find_if(OptionList, SameOptName);<br>
+<br>
+  if (OptionIt == OptionList.end()) {<br>
+    Diags.Report(diag::err_analyzer_checker_option_unknown)<br>
+        << SuppliedChecker << SuppliedOption;<br>
+    return;<br>
+  }<br>
+}<br>
+<br>
 void CheckerRegistry::validateCheckerOptions() const {<br>
   for (const auto &Config : AnOpts.Config) {<br>
-    size_t Pos = Config.getKey().find(':');<br>
-    if (Pos == StringRef::npos)<br>
+<br>
+    StringRef SuppliedChecker;<br>
+    StringRef SuppliedOption;<br>
+    std::tie(SuppliedChecker, SuppliedOption) = Config.getKey().split(':');<br>
+<br>
+    if (SuppliedOption.empty())<br>
       continue;<br>
<br>
-    bool HasChecker = false;<br>
-    StringRef CheckerName = Config.getKey().substr(0, Pos);<br>
-    for (const auto &Checker : Checkers) {<br>
-      if (Checker.FullName.startswith(CheckerName) &&<br>
-          (Checker.FullName.size() == Pos || Checker.FullName[Pos] == '.')) {<br>
-        HasChecker = true;<br>
-        break;<br>
-      }<br>
+    // AnalyzerOptions' config table contains the user input, so an entry could<br>
+    // look like this:<br>
+    //<br>
+    //   cor:NoFalsePositives=true<br>
+    //<br>
+    // Since lower_bound would look for the first element *not less* than "cor",<br>
+    // it would return with an iterator to the first checker in the core, so we<br>
+    // we really have to use find here, which uses operator==.<br>
+    auto CheckerIt = llvm::find(Checkers, CheckerInfo(SuppliedChecker));<br>
+    if (CheckerIt != Checkers.end()) {<br>
+      isOptionContainedIn(CheckerIt->CmdLineOptions, SuppliedChecker,<br>
+                          SuppliedOption, AnOpts, Diags);<br>
+      continue;<br>
+    }<br>
+<br>
+    auto PackageIt = llvm::find(Packages, PackageInfo(SuppliedChecker));<br>
+    if (PackageIt != Packages.end()) {<br>
+      isOptionContainedIn(PackageIt->CmdLineOptions, SuppliedChecker,<br>
+                          SuppliedOption, AnOpts, Diags);<br>
+      continue;<br>
     }<br>
-    if (!HasChecker)<br>
-      Diags.Report(diag::err_unknown_analyzer_checker) << CheckerName;<br>
+<br>
+    Diags.Report(diag::err_unknown_analyzer_checker) << SuppliedChecker;<br>
   }<br>
 }<br>
<br>
<br>
Modified: cfe/trunk/test/Analysis/checker-plugins.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/checker-plugins.c?rev=361011&r1=361010&r2=361011&view=diff" rel="noreferrer" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/checker-plugins.c?rev=361011&r1=361010&r2=361011&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Analysis/checker-plugins.c (original)<br>
+++ cfe/trunk/test/Analysis/checker-plugins.c Fri May 17 02:51:59 2019<br>
@@ -62,3 +62,35 @@ void caller() {<br>
 // RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-CHECKER-OPTION-TRUE<br>
<br>
 // CHECK-CHECKER-OPTION-TRUE: example.MyChecker:ExampleOption = true<br>
+<br>
+// RUN: not %clang_analyze_cc1 -verify %s \<br>
+// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\<br>
+// RUN:   -analyzer-checker=example.MyChecker \<br>
+// RUN:   -analyzer-config example.MyChecker:Example=true \<br>
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-NON-EXISTENT-CHECKER-OPTION<br>
+<br>
+// CHECK-NON-EXISTENT-CHECKER-OPTION: (frontend): checker 'example.MyChecker'<br>
+// CHECK-NON-EXISTENT-CHECKER-OPTION-SAME: has no option called 'Example'<br>
+<br>
+// RUN: not %clang_analyze_cc1 -verify %s \<br>
+// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\<br>
+// RUN:   -analyzer-checker=example.MyChecker \<br>
+// RUN:   -analyzer-config-compatibility-mode=true \<br>
+// RUN:   -analyzer-config example.MyChecker:Example=true<br>
+<br>
+<br>
+// RUN: not %clang_analyze_cc1 -verify %s \<br>
+// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\<br>
+// RUN:   -analyzer-checker=example.MyChecker \<br>
+// RUN:   -analyzer-config example.MyChecker:ExampleOption=example \<br>
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-INVALID-BOOL-VALUE<br>
+<br>
+// CHECK-INVALID-BOOL-VALUE: (frontend): invalid input for checker option<br>
+// CHECK-INVALID-BOOL-VALUE-SAME: 'example.MyChecker:ExampleOption', that<br>
+// CHECK-INVALID-BOOL-VALUE-SAME: expects a boolean value<br>
+<br>
+// RUN: not %clang_analyze_cc1 -verify %s \<br>
+// RUN:   -load %llvmshlibdir/CheckerOptionHandlingAnalyzerPlugin%pluginext\<br>
+// RUN:   -analyzer-checker=example.MyChecker \<br>
+// RUN:   -analyzer-config-compatibility-mode=true \<br>
+// RUN:   -analyzer-config example.MyChecker:ExampleOption=example<br>
<br>
Modified: cfe/trunk/test/Analysis/invalid-checker-option.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/invalid-checker-option.c?rev=361011&r1=361010&r2=361011&view=diff" rel="noreferrer" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/invalid-checker-option.c?rev=361011&r1=361010&r2=361011&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Analysis/invalid-checker-option.c (original)<br>
+++ cfe/trunk/test/Analysis/invalid-checker-option.c Fri May 17 02:51:59 2019<br>
@@ -14,6 +14,63 @@<br>
 // CHECK-NON-EXISTENT-CHECKER: (frontend): no analyzer checkers or packages<br>
 // CHECK-NON-EXISTENT-CHECKER-SAME: are associated with 'RetainOneTwoThree'<br>
<br>
+<br>
+// Every other error should be avoidable in compatiblity mode.<br>
+<br>
+<br>
+// RUN: not %clang_analyze_cc1 -verify %s \<br>
+// RUN:   -analyzer-checker=core \<br>
+// RUN:   -analyzer-config debug.AnalysisOrder:Everything=false \<br>
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-NON-EXISTENT-CHECKER-OPTION<br>
+<br>
+// CHECK-NON-EXISTENT-CHECKER-OPTION: (frontend): checker 'debug.AnalysisOrder'<br>
+// CHECK-NON-EXISTENT-CHECKER-OPTION-SAME: has no option called 'Everything'<br>
+<br>
+// RUN: %clang_analyze_cc1 -verify %s \<br>
+// RUN:   -analyzer-checker=core \<br>
+// RUN:   -analyzer-config-compatibility-mode=true \<br>
+// RUN:   -analyzer-config debug.AnalysisOrder:Everything=false<br>
+<br>
+<br>
+// RUN: not %clang_analyze_cc1 -verify %s \<br>
+// RUN:   -analyzer-checker=core \<br>
+// RUN:   -analyzer-config debug.AnalysisOrder:*=nothankyou \<br>
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-INVALID-BOOL-VALUE<br>
+<br>
+// CHECK-INVALID-BOOL-VALUE: (frontend): invalid input for checker option<br>
+// CHECK-INVALID-BOOL-VALUE-SAME: 'debug.AnalysisOrder:*', that expects a<br>
+// CHECK-INVALID-BOOL-VALUE-SAME: boolean value<br>
+<br>
+// RUN: %clang_analyze_cc1 -verify %s \<br>
+// RUN:   -analyzer-checker=core \<br>
+// RUN:   -analyzer-config-compatibility-mode=true \<br>
+// RUN:   -analyzer-config debug.AnalysisOrder:*=nothankyou<br>
+<br>
+<br>
+// RUN: not %clang_analyze_cc1 -verify %s \<br>
+// RUN:   -analyzer-checker=core \<br>
+// RUN:   -analyzer-config optin.performance.Padding:AllowedPad=surpriseme \<br>
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-INVALID-INT-VALUE<br>
+<br>
+// CHECK-INVALID-INT-VALUE: (frontend): invalid input for checker option<br>
+// CHECK-INVALID-INT-VALUE-SAME: 'optin.performance.Padding:AllowedPad', that<br>
+// CHECK-INVALID-INT-VALUE-SAME: expects an integer value<br>
+<br>
+// RUN: %clang_analyze_cc1 -verify %s \<br>
+// RUN:   -analyzer-checker=core \<br>
+// RUN:   -analyzer-config-compatibility-mode=true \<br>
+// RUN:   -analyzer-config optin.performance.Padding:AllowedPad=surpriseme<br>
+<br>
+<br>
+// RUN: not %clang_analyze_cc1 -verify %s \<br>
+// RUN:   -analyzer-checker=core \<br>
+// RUN:   -analyzer-config nullability:NoDiagnoseCallsToSystemHeaders=sure \<br>
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-PACKAGE-VALUE<br>
+<br>
+// CHECK-PACKAGE-VALUE: (frontend): invalid input for checker option<br>
+// CHECK-PACKAGE-VALUE-SAME: 'nullability:NoDiagnoseCallsToSystemHeaders', that<br>
+// CHECK-PACKAGE-VALUE-SAME: expects a boolean value<br>
+<br>
 // expected-no-diagnostics<br>
<br>
 int main() {}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote>
</div>
</div>
</div>
</body>
</html>