[PATCH] Add `-verify-ignore-unexpected` option to ignore unexpected diagnostics in VerifyDiagnosticsConsumer

Eric Fiselier eric at efcs.ca
Thu Jun 11 13:35:48 PDT 2015

Responding to @bogner's comments that he sent via email.

Comment at: include/clang/Basic/DiagnosticOptions.h:37
@@ -27,1 +36,3 @@
 /// \brief Options for controlling the compiler diagnostics engine.
> Better to use `enum class DiagnosticLevelMask`. You'll need to define
> operator| and operator|=, but those are trivial with std::underlying_type.

I would add `operator&(Enum, Enum)`, `operator|(Enum, Enum)` and `~operator(

I would prefer to use a enum class but there are a couple of problems:
1. You need to define a `raw_ostream operator<<(...)` function. This is required by the ENUM_DIAGOPT macro. 
2. `if (EnumValue & Enum::Value)`  doesn't work. You need the explicit bool cast which is ugly. 

Comment at: lib/Frontend/VerifyDiagnosticConsumer.cpp:750
@@ -747,1 +749,3 @@
+  DiagnosticLevelMask const IgnoredUnexpectedLevels =
+    Diags.getDiagnosticOptions().VerifyIgnoreUnexpected;
> Why bother making this const? Also, a name like DiagMask is probably clearer.

I like to make things const so I can't accidentally change it. I'm happy to change the name though.



More information about the cfe-commits mailing list