[PATCH] D53280: [analyzer] Emit an error for invalid -analyzer-config inputs

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 27 08:51:29 PST 2018


xazax.hun accepted this revision.
xazax.hun added a comment.
This revision is now accepted and ready to land.

Overall looks good to me, some minor comments inline.



================
Comment at: include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:231
 #define ANALYZER_OPTION(TYPE, NAME, CMDFLAG, DESC, DEFAULT_VAL)                \
+  /* Create a field for each -analyzer-config option. */                       \
   TYPE NAME;
----------------
I wonder if it is a good idea to put the comment inside the macro.


================
Comment at: lib/Driver/ToolChains/Clang.cpp:2348
+  // Enable compatilibily mode to avoid analyzer-config related errors.
+  CmdArgs.push_back("-analyzer-config-compatibility-mode=true");
+
----------------
I wonder if it makes more sense to not add this here but rather make the default option to be true.


================
Comment at: lib/Frontend/CompilerInvocation.cpp:367
 
-  parseAnalyzerConfigs(Opts, Diags);
+  if (Opts.ShouldEmitErrorsOnInvalidConfigValue)
+    parseAnalyzerConfigs(Opts, &Diags);
----------------
Do we actually need the branching here? It would be perfectly fine to always pass a pointer to `Diags` but sometimes just ignore it.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53280/new/

https://reviews.llvm.org/D53280





More information about the cfe-commits mailing list