r368980 - [analyzer] Warn about -analyzer-configs being meant for development purposes only

Kristof Umann via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 15 01:53:16 PDT 2019

Author: szelethus
Date: Thu Aug 15 01:53:16 2019
New Revision: 368980

URL: http://llvm.org/viewvc/llvm-project?rev=368980&view=rev
[analyzer] Warn about -analyzer-configs being meant for development purposes only

This is more of a temporary fix, long term, we should convert AnalyzerOptions.def
into the universally beloved (*coughs*) TableGen format, where they can more
easily be separated into developer-only, alpha, and user-facing configs.

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


Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=368980&r1=368979&r2=368980&view=diff
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Thu Aug 15 01:53:16 2019
@@ -140,7 +140,8 @@ def analyzer_checker_help_developer : Fl
            "and debug checkers">;
 def analyzer_config_help : Flag<["-"], "analyzer-config-help">,
-  HelpText<"Display the list of -analyzer-config options">;
+  HelpText<"Display the list of -analyzer-config options. These are meant for "
+           "development purposes only!">;
 def analyzer_list_enabled_checkers : Flag<["-"], "analyzer-list-enabled-checkers">,
   HelpText<"Display the list of enabled analyzer checkers">;

Modified: cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp?rev=368980&r1=368979&r2=368980&view=diff
--- cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp Thu Aug 15 01:53:16 2019
@@ -74,11 +74,22 @@ void ento::printCheckerConfigList(raw_os
 void ento::printAnalyzerConfigList(raw_ostream &out) {
-  out << "OVERVIEW: Clang Static Analyzer -analyzer-config Option List\n\n";
-  out << "USAGE: -analyzer-config <OPTION1=VALUE,OPTION2=VALUE,...>\n\n";
-  out << "       -analyzer-config OPTION1=VALUE, -analyzer-config "
-         "OPTION2=VALUE, ...\n\n";
-  out << "OPTIONS:\n\n";
+  // FIXME: This message sounds scary, should be scary, but incorrectly states
+  // that all configs are super dangerous. In reality, many of them should be
+  // accessible to the user. We should create a user-facing subset of config
+  // options under a different frontend flag.
+  out << R"(
+OVERVIEW: Clang Static Analyzer -analyzer-config Option List
+The following list of configurations are meant for development purposes only, as
+some of the variables they define are set to result in the most optimal
+analysis. Setting them to other values may drastically change how the analyzer
+behaves, and may even result in instabilities, crashes!
+USAGE: -analyzer-config <OPTION1=VALUE,OPTION2=VALUE,...>
+       -analyzer-config OPTION1=VALUE, -analyzer-config OPTION2=VALUE, ...
   using OptionAndDescriptionTy = std::pair<StringRef, std::string>;
   OptionAndDescriptionTy PrintableOptions[] = {

More information about the cfe-commits mailing list