[PATCH] D62885: [analyzer] Add werror flag for analyzer warnings

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 7 13:36:55 PDT 2019


Szelethus accepted this revision.
Szelethus added a comment.





================
Comment at: include/clang/Driver/CC1Options.td:170
+def analyzer_werror : Flag<["-"], "analyzer-werror">,
+  HelpText<"Emit analyzer results as errors, not warnings">;
+
----------------
how about "rather than warnings"?


================
Comment at: lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:86
   DiagnosticsEngine &Diag;
-  bool IncludePath;
+  bool IncludePath, Werror;
+
----------------
I personally dislike boolean variable names that do not start with "is", "has", "should", "was" etc.


================
Comment at: test/Analysis/override-werror.c:10
+  return p; // expected-warning{{incompatible pointer types}} \
+               werror-warning{{incompatible pointer types}}
 }
----------------
loladiro wrote:
> Szelethus wrote:
> > Why isn't this `werror-error`?
> Unlike the other error (which is generated by the analyzer), this is a semantic error (i.e. would get emitted even in the absence of the analyzer). The `-analyzer-werror` flag only touches those warnings generated by the analyzer, so this is the desired behavior.
Ah okay :)


Repository:
  rC Clang

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

https://reviews.llvm.org/D62885





More information about the cfe-commits mailing list