This is an archive of the discontinued LLVM Phabricator instance.

Add `-verify-ignore-unexpected` option to ignore unexpected diagnostics in VerifyDiagnosticsConsumer
ClosedPublic

Authored by EricWF on May 29 2015, 2:28 PM.

Details

Summary

The goal of this patch is to make -verify easier to use when testing libc++. The notes attached to compile error diagnostics are numerous and relatively unstable when they reference libc++ header internals. This patch allows libc++ to write stable compilation failure tests by allowing unexpected diagnostic messages to be ignored where they are not relevant.

This patch adds a new CC1 flag called -verify-ignore-unexpected. -verify-ignore-unexpected tells VerifyDiagnosticsConsumer to ignore *all* unexpected diagnostic messages. -verify-ignore-unexpected=<LevelList> can be used to only ignore certain diagnostic levels. <LevelList> is a comma separated list of diagnostic levels to ignore. The supported levels are note, remark, warning and error.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 26818.May 29 2015, 2:28 PM
EricWF retitled this revision from to Add `-verify-ignore-unexpected` option to ignore unexpected diagnostics in VerifyDiagnosticsConsumer.
EricWF updated this object.
EricWF edited the test plan for this revision. (Show Details)
EricWF added reviewers: bogner, grosser, alexfh.
EricWF added a subscriber: Unknown Object (MLST).
alexfh removed a reviewer: alexfh.Jun 5 2015, 8:03 AM

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

include/clang/Basic/DiagnosticOptions.h
37

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.
lib/Frontend/VerifyDiagnosticConsumer.cpp
750

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.

EricWF updated this revision to Diff 27560.Jun 11 2015, 5:52 PM

Address @bogner's comments.

EricWF updated this revision to Diff 27633.Jun 13 2015, 12:06 AM

Address @bogners comments.

EricWF accepted this revision.Jun 13 2015, 12:14 AM
EricWF added a reviewer: EricWF.

Accepting with @bogner's permission.

This revision is now accepted and ready to land.Jun 13 2015, 12:14 AM
EricWF closed this revision.Jun 13 2015, 12:15 AM