r202475 - Add 'remark' diagnostic type in 'clang'

Alp Toker alp at nuanti.com
Sun Mar 2 05:10:30 PST 2014


Tests? VerifyDiagnosticConsumer support? libclang stability?

Trying to emit a 'remark' asserts with "Diagnostic not handled during 
diagnostic buffering!" right now so it doesn't quite seem to be working.

Moreover the libclang changes are breaking stable applications here when 
remark diags are encountered, either due to missing handling in language 
bindings, or otherwise when remarks get treated as fatal errors due to 
incorrect severity being reported (clang_getDiagnosticSeverity(diag) >= 
CXDiagnostic_Error).

Both of these require application code using libclang to be rewritten if 
this approach is taken and so should be avoided until remark semantics 
are stable and some compelling use cases have landed.

(While I said "OK" to a specific point, I didn't mean "OK to land" and 
hadn't looked at the patch in depth yet. The changes need to come with a 
couple of tests at the least, and they've yet to be reviewed/LGTM'd by 
the usual maintainers.)

Alp.



On 28/02/2014 09:11, Tobias Grosser wrote:
> Author: grosser
> Date: Fri Feb 28 03:11:08 2014
> New Revision: 202475
>
> URL: http://llvm.org/viewvc/llvm-project?rev=202475&view=rev
> Log:
> Add 'remark' diagnostic type in 'clang'
>
> A 'remark' is information that is not an error or a warning, but rather some
> additional information provided to the user. In contrast to a 'note' a 'remark'
> is an independent diagnostic, whereas a 'note' always depends on another
> diagnostic.
>
> A typical use case for remark nodes is information provided to the user, e.g.
> information provided by the vectorizer about loops that have been vectorized.
>
> This patch provides the initial implementation of 'remarks'. It includes the
> actual definiton of the remark nodes, their printing as well as basic parameter
> handling. We are reusing the existing diagnostic parameters which means a remark
> can be enabled with normal '-Wdiagnostic-name' flags and can be upgraded to
> an error using '-Werror=diagnostic-name'. '-Werror' alone does not upgrade
> remarks.
>
> This patch is by intention minimal in terms of parameter handling. More
> experience and more discussions will most likely lead to further enhancements
> in the parameter handling.
>
> Modified:
>      cfe/trunk/docs/InternalsManual.rst
>      cfe/trunk/docs/UsersManual.rst
>      cfe/trunk/include/clang-c/Index.h
>      cfe/trunk/include/clang/Basic/Diagnostic.h
>      cfe/trunk/include/clang/Basic/Diagnostic.td
>      cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
>      cfe/trunk/include/clang/Basic/DiagnosticGroups.td
>      cfe/trunk/include/clang/Basic/DiagnosticIDs.h
>      cfe/trunk/lib/Basic/DiagnosticIDs.cpp
>      cfe/trunk/lib/CodeGen/CodeGenAction.cpp
>      cfe/trunk/lib/Frontend/LogDiagnosticPrinter.cpp
>      cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
>      cfe/trunk/lib/Frontend/TextDiagnostic.cpp
>      cfe/trunk/tools/c-index-test/c-index-test.c
>      cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp
>      cfe/trunk/tools/libclang/CIndexDiagnostic.cpp
>      cfe/trunk/tools/libclang/CXStoredDiagnostic.cpp
>      cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp
>
> Modified: cfe/trunk/docs/InternalsManual.rst
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/InternalsManual.rst?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/docs/InternalsManual.rst (original)
> +++ cfe/trunk/docs/InternalsManual.rst Fri Feb 28 03:11:08 2014
> @@ -87,7 +87,8 @@ start with ``err_``, ``warn_``, ``ext_``
>   Since the enum is referenced in the C++ code that produces the diagnostic, it
>   is somewhat useful for it to be reasonably short.
>   
> -The severity of the diagnostic comes from the set {``NOTE``, ``WARNING``,
> +The severity of the diagnostic comes from the set {``NOTE``, ``REMARK``,
> +``WARNING``,
>   ``EXTENSION``, ``EXTWARN``, ``ERROR``}.  The ``ERROR`` severity is used for
>   diagnostics indicating the program is never acceptable under any circumstances.
>   When an error is emitted, the AST for the input code may not be fully built.
> @@ -97,11 +98,13 @@ represent them in the AST, but we produc
>   code is non-portable.  The difference is that the former are ignored by
>   default, and the later warn by default.  The ``WARNING`` severity is used for
>   constructs that are valid in the currently selected source language but that
> -are dubious in some way.  The ``NOTE`` level is used to staple more information
> -onto previous diagnostics.
> +are dubious in some way.  The ``REMARK`` severity provides generic information
> +about the compilation that is not necessarily related to any dubious code.  The
> +``NOTE`` level is used to staple more information onto previous diagnostics.
>   
>   These *severities* are mapped into a smaller set (the ``Diagnostic::Level``
> -enum, {``Ignored``, ``Note``, ``Warning``, ``Error``, ``Fatal``}) of output
> +enum, {``Ignored``, ``Note``, ``Remark``, ``Warning``, ``Error``, ``Fatal``}) of
> +output
>   *levels* by the diagnostics subsystem based on various configuration options.
>   Clang internally supports a fully fine grained mapping mechanism that allows
>   you to map almost any diagnostic to the output level that you want.  The only
>
> Modified: cfe/trunk/docs/UsersManual.rst
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/docs/UsersManual.rst (original)
> +++ cfe/trunk/docs/UsersManual.rst Fri Feb 28 03:11:08 2014
> @@ -112,11 +112,11 @@ Options to Control Error and Warning Mes
>   
>   .. option:: -w
>   
> -  Disable all warnings.
> +  Disable all diagnostics.
>   
>   .. option:: -Weverything
>   
> -  :ref:`Enable all warnings. <diagnostics_enable_everything>`
> +  :ref:`Enable all diagnostics. <diagnostics_enable_everything>`
>   
>   .. option:: -pedantic
>   
> @@ -582,6 +582,7 @@ All diagnostics are mapped into one of t
>   
>   -  Ignored
>   -  Note
> +-  Remark
>   -  Warning
>   -  Error
>   -  Fatal
> @@ -722,11 +723,12 @@ is treated as a system header.
>   
>   .. _diagnostics_enable_everything:
>   
> -Enabling All Warnings
> -^^^^^^^^^^^^^^^^^^^^^
> +Enabling All Diagnostics
> +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   
>   In addition to the traditional ``-W`` flags, one can enable **all**
> -warnings by passing :option:`-Weverything`. This works as expected with
> +diagnostics by passing :option:`-Weverything`. This works as expected
> +with
>   :option:`-Werror`, and also includes the warnings from :option:`-pedantic`.
>   
>   Note that when combined with :option:`-w` (which disables all warnings), that
>
> Modified: cfe/trunk/include/clang-c/Index.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang-c/Index.h (original)
> +++ cfe/trunk/include/clang-c/Index.h Fri Feb 28 03:11:08 2014
> @@ -653,6 +653,12 @@ enum CXDiagnosticSeverity {
>     CXDiagnostic_Note    = 1,
>   
>     /**
> +   * \brief This diagnostic is a remark that provides additional information
> +   * for the user.
> +   */
> +  CXDiagnostic_Remark = 5,
> +
> +  /**
>      * \brief This diagnostic indicates suspicious code that may not be
>      * wrong.
>      */
>
> Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
> +++ cfe/trunk/include/clang/Basic/Diagnostic.h Fri Feb 28 03:11:08 2014
> @@ -142,6 +142,7 @@ public:
>     enum Level {
>       Ignored = DiagnosticIDs::Ignored,
>       Note = DiagnosticIDs::Note,
> +    Remark = DiagnosticIDs::Remark,
>       Warning = DiagnosticIDs::Warning,
>       Error = DiagnosticIDs::Error,
>       Fatal = DiagnosticIDs::Fatal
>
> Modified: cfe/trunk/include/clang/Basic/Diagnostic.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.td?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/Diagnostic.td (original)
> +++ cfe/trunk/include/clang/Basic/Diagnostic.td Fri Feb 28 03:11:08 2014
> @@ -15,6 +15,7 @@
>   // Define the diagnostic mappings.
>   class DiagMapping;
>   def MAP_IGNORE  : DiagMapping;
> +def MAP_REMARK  : DiagMapping;
>   def MAP_WARNING : DiagMapping;
>   def MAP_ERROR   : DiagMapping;
>   def MAP_FATAL   : DiagMapping;
> @@ -22,6 +23,7 @@ def MAP_FATAL   : DiagMapping;
>   // Define the diagnostic classes.
>   class DiagClass;
>   def CLASS_NOTE      : DiagClass;
> +def CLASS_REMARK    : DiagClass;
>   def CLASS_WARNING   : DiagClass;
>   def CLASS_EXTENSION : DiagClass;
>   def CLASS_ERROR     : DiagClass;
> @@ -84,6 +86,7 @@ class AccessControl {
>   // FIXME: ExtWarn and Extension should also be SFINAEFailure by default.
>   class Error<string str>     : Diagnostic<str, CLASS_ERROR, MAP_ERROR>, SFINAEFailure;
>   class Warning<string str>   : Diagnostic<str, CLASS_WARNING, MAP_WARNING>;
> +class Remark<string str>    : Diagnostic<str, CLASS_REMARK, MAP_IGNORE>;
>   class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_IGNORE>;
>   class ExtWarn<string str>   : Diagnostic<str, CLASS_EXTENSION, MAP_WARNING>;
>   class Note<string str>      : Diagnostic<str, CLASS_NOTE, MAP_FATAL/*ignored*/>;
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticFrontendKinds.td Fri Feb 28 03:11:08 2014
> @@ -29,6 +29,7 @@ def note_fe_backend_frame_larger_than: N
>   
>   def warn_fe_backend_plugin: Warning<"%0">, CatBackend, InGroup<BackendPlugin>;
>   def err_fe_backend_plugin: Error<"%0">, CatBackend;
> +def remark_fe_backend_plugin: Remark<"%0">, CatBackend, InGroup<RemarkBackendPlugin>;
>   def note_fe_backend_plugin: Note<"%0">, CatBackend;
>   
>   def err_fe_invalid_code_complete_file : Error<
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Fri Feb 28 03:11:08 2014
> @@ -637,3 +637,4 @@ def SourceUsesOpenMP : DiagGroup<"source
>   def BackendInlineAsm : DiagGroup<"inline-asm">;
>   def BackendFrameLargerThan : DiagGroup<"frame-larger-than">;
>   def BackendPlugin : DiagGroup<"backend-plugin">;
> +def RemarkBackendPlugin : DiagGroup<"remark-backend-plugin">;
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticIDs.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticIDs.h?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticIDs.h (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticIDs.h Fri Feb 28 03:11:08 2014
> @@ -56,16 +56,17 @@ namespace clang {
>       };
>   
>       /// Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs
> -    /// to either MAP_IGNORE (nothing), MAP_WARNING (emit a warning), MAP_ERROR
> -    /// (emit as an error).  It allows clients to map errors to
> -    /// MAP_ERROR/MAP_DEFAULT or MAP_FATAL (stop emitting diagnostics after this
> -    /// one).
> +    /// to either MAP_IGNORE (nothing), MAP_REMARK (emit a remark), MAP_WARNING
> +    /// (emit a warning), MAP_ERROR (emit as an error).  It allows clients to
> +    /// map errors to MAP_ERROR/MAP_DEFAULT or MAP_FATAL (stop emitting
> +    /// diagnostics after this one).
>       enum Mapping {
>         // NOTE: 0 means "uncomputed".
>         MAP_IGNORE  = 1,     ///< Map this diagnostic to nothing, ignore it.
> -      MAP_WARNING = 2,     ///< Map this diagnostic to a warning.
> -      MAP_ERROR   = 3,     ///< Map this diagnostic to an error.
> -      MAP_FATAL   = 4      ///< Map this diagnostic to a fatal error.
> +      MAP_REMARK  = 2,     ///< Map this diagnostic to a remark.
> +      MAP_WARNING = 3,     ///< Map this diagnostic to a warning.
> +      MAP_ERROR   = 4,     ///< Map this diagnostic to an error.
> +      MAP_FATAL   = 5      ///< Map this diagnostic to a fatal error.
>       };
>     }
>   
> @@ -113,7 +114,7 @@ class DiagnosticIDs : public RefCountedB
>   public:
>     /// \brief The level of the diagnostic, after it has been through mapping.
>     enum Level {
> -    Ignored, Note, Warning, Error, Fatal
> +    Ignored, Note, Remark, Warning, Error, Fatal
>     };
>   
>   private:
>
> Modified: cfe/trunk/lib/Basic/DiagnosticIDs.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/DiagnosticIDs.cpp?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Basic/DiagnosticIDs.cpp (original)
> +++ cfe/trunk/lib/Basic/DiagnosticIDs.cpp Fri Feb 28 03:11:08 2014
> @@ -30,9 +30,10 @@ namespace {
>   // Diagnostic classes.
>   enum {
>     CLASS_NOTE       = 0x01,
> -  CLASS_WARNING    = 0x02,
> -  CLASS_EXTENSION  = 0x03,
> -  CLASS_ERROR      = 0x04
> +  CLASS_REMARK     = 0x02,
> +  CLASS_WARNING    = 0x03,
> +  CLASS_EXTENSION  = 0x04,
> +  CLASS_ERROR      = 0x05
>   };
>   
>   struct StaticDiagInfoRec {
> @@ -409,6 +410,9 @@ DiagnosticIDs::getDiagnosticLevel(unsign
>     case diag::MAP_IGNORE:
>       Result = DiagnosticIDs::Ignored;
>       break;
> +  case diag::MAP_REMARK:
> +    Result = DiagnosticIDs::Remark;
> +    break;
>     case diag::MAP_WARNING:
>       Result = DiagnosticIDs::Warning;
>       break;
> @@ -425,6 +429,11 @@ DiagnosticIDs::getDiagnosticLevel(unsign
>         !MappingInfo.isUser())
>       Result = DiagnosticIDs::Warning;
>   
> +  // Diagnostics of class REMARK are either printed as remarks or in case they
> +  // have been added to -Werror they are printed as errors.
> +  if (DiagClass == CLASS_REMARK && Result == DiagnosticIDs::Warning)
> +    Result = DiagnosticIDs::Remark;
> +
>     // Ignore -pedantic diagnostics inside __extension__ blocks.
>     // (The diagnostics controlled by -pedantic are the extension diagnostics
>     // that are not enabled by default.)
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Fri Feb 28 03:11:08 2014
> @@ -307,6 +307,27 @@ void BackendConsumer::InlineAsmDiagHandl
>       case llvm::DS_Warning:                                                     \
>         DiagID = diag::warn_fe_##GroupName;                                      \
>         break;                                                                   \
> +    case llvm::DS_Remark:                                                      \
> +      llvm_unreachable("'remark' severity not expected");                      \
> +      break;                                                                   \
> +    case llvm::DS_Note:                                                        \
> +      DiagID = diag::note_fe_##GroupName;                                      \
> +      break;                                                                   \
> +    }                                                                          \
> +  } while (false)
> +
> +#define ComputeDiagRemarkID(Severity, GroupName, DiagID)                       \
> +  do {                                                                         \
> +    switch (Severity) {                                                        \
> +    case llvm::DS_Error:                                                       \
> +      DiagID = diag::err_fe_##GroupName;                                       \
> +      break;                                                                   \
> +    case llvm::DS_Warning:                                                     \
> +      DiagID = diag::warn_fe_##GroupName;                                      \
> +      break;                                                                   \
> +    case llvm::DS_Remark:                                                      \
> +      DiagID = diag::remark_fe_##GroupName;                                    \
> +      break;                                                                   \
>       case llvm::DS_Note:                                                        \
>         DiagID = diag::note_fe_##GroupName;                                      \
>         break;                                                                   \
> @@ -372,7 +393,7 @@ void BackendConsumer::DiagnosticHandlerI
>       break;
>     default:
>       // Plugin IDs are not bound to any value as they are set dynamically.
> -    ComputeDiagID(Severity, backend_plugin, DiagID);
> +    ComputeDiagRemarkID(Severity, backend_plugin, DiagID);
>       break;
>     }
>     std::string MsgStorage;
>
> Modified: cfe/trunk/lib/Frontend/LogDiagnosticPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/LogDiagnosticPrinter.cpp?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/LogDiagnosticPrinter.cpp (original)
> +++ cfe/trunk/lib/Frontend/LogDiagnosticPrinter.cpp Fri Feb 28 03:11:08 2014
> @@ -31,6 +31,7 @@ LogDiagnosticPrinter::~LogDiagnosticPrin
>   static StringRef getLevelName(DiagnosticsEngine::Level Level) {
>     switch (Level) {
>     case DiagnosticsEngine::Ignored: return "ignored";
> +  case DiagnosticsEngine::Remark:  return "remark";
>     case DiagnosticsEngine::Note:    return "note";
>     case DiagnosticsEngine::Warning: return "warning";
>     case DiagnosticsEngine::Error:   return "error";
>
> Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)
> +++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Fri Feb 28 03:11:08 2014
> @@ -459,6 +459,9 @@ PragmaDiagnostic(SourceLocation Loc, Str
>     MoveToLine(Loc);
>     OS << "#pragma " << Namespace << " diagnostic ";
>     switch (Map) {
> +  case diag::MAP_REMARK:
> +    OS << "remark";
> +    break;
>     case diag::MAP_WARNING:
>       OS << "warning";
>       break;
>
> Modified: cfe/trunk/lib/Frontend/TextDiagnostic.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnostic.cpp?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/TextDiagnostic.cpp (original)
> +++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp Fri Feb 28 03:11:08 2014
> @@ -26,6 +26,8 @@ using namespace clang;
>   
>   static const enum raw_ostream::Colors noteColor =
>     raw_ostream::BLACK;
> +static const enum raw_ostream::Colors remarkColor =
> +  raw_ostream::BLUE;
>   static const enum raw_ostream::Colors fixitColor =
>     raw_ostream::GREEN;
>   static const enum raw_ostream::Colors caretColor =
> @@ -711,6 +713,7 @@ TextDiagnostic::printDiagnosticLevel(raw
>       case DiagnosticsEngine::Ignored:
>         llvm_unreachable("Invalid diagnostic type");
>       case DiagnosticsEngine::Note:    OS.changeColor(noteColor, true); break;
> +    case DiagnosticsEngine::Remark:  OS.changeColor(remarkColor, true); break;
>       case DiagnosticsEngine::Warning: OS.changeColor(warningColor, true); break;
>       case DiagnosticsEngine::Error:   OS.changeColor(errorColor, true); break;
>       case DiagnosticsEngine::Fatal:   OS.changeColor(fatalColor, true); break;
> @@ -721,6 +724,7 @@ TextDiagnostic::printDiagnosticLevel(raw
>     case DiagnosticsEngine::Ignored:
>       llvm_unreachable("Invalid diagnostic type");
>     case DiagnosticsEngine::Note:    OS << "note"; break;
> +  case DiagnosticsEngine::Remark:  OS << "remark"; break;
>     case DiagnosticsEngine::Warning: OS << "warning"; break;
>     case DiagnosticsEngine::Error:   OS << "error"; break;
>     case DiagnosticsEngine::Fatal:   OS << "fatal error"; break;
>
> Modified: cfe/trunk/tools/c-index-test/c-index-test.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/tools/c-index-test/c-index-test.c (original)
> +++ cfe/trunk/tools/c-index-test/c-index-test.c Fri Feb 28 03:11:08 2014
> @@ -3736,6 +3736,7 @@ static const char *getDiagnosticCodeStr(
>   static const char *getSeverityString(enum CXDiagnosticSeverity severity) {
>     switch (severity) {
>       case CXDiagnostic_Note: return "note";
> +    case CXDiagnostic_Remark: return "remark";
>       case CXDiagnostic_Error: return "error";
>       case CXDiagnostic_Fatal: return "fatal";
>       case CXDiagnostic_Ignored: return "ignored";
>
> Modified: cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp (original)
> +++ cfe/trunk/tools/diagtool/ShowEnabledWarnings.cpp Fri Feb 28 03:11:08 2014
> @@ -44,6 +44,7 @@ static char getCharForLevel(DiagnosticsE
>     switch (Level) {
>     case DiagnosticsEngine::Ignored: return ' ';
>     case DiagnosticsEngine::Note:    return '-';
> +  case DiagnosticsEngine::Remark:  return 'R';
>     case DiagnosticsEngine::Warning: return 'W';
>     case DiagnosticsEngine::Error:   return 'E';
>     case DiagnosticsEngine::Fatal:   return 'F';
>
> Modified: cfe/trunk/tools/libclang/CIndexDiagnostic.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexDiagnostic.cpp?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/tools/libclang/CIndexDiagnostic.cpp (original)
> +++ cfe/trunk/tools/libclang/CIndexDiagnostic.cpp Fri Feb 28 03:11:08 2014
> @@ -305,6 +305,7 @@ CXString clang_formatDiagnostic(CXDiagno
>     switch (Severity) {
>     case CXDiagnostic_Ignored: llvm_unreachable("impossible");
>     case CXDiagnostic_Note: Out << "note: "; break;
> +  case CXDiagnostic_Remark: Out << "remark: "; break;
>     case CXDiagnostic_Warning: Out << "warning: "; break;
>     case CXDiagnostic_Error: Out << "error: "; break;
>     case CXDiagnostic_Fatal: Out << "fatal error: "; break;
>
> Modified: cfe/trunk/tools/libclang/CXStoredDiagnostic.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXStoredDiagnostic.cpp?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/tools/libclang/CXStoredDiagnostic.cpp (original)
> +++ cfe/trunk/tools/libclang/CXStoredDiagnostic.cpp Fri Feb 28 03:11:08 2014
> @@ -31,6 +31,7 @@ CXDiagnosticSeverity CXStoredDiagnostic:
>     switch (Diag.getLevel()) {
>       case DiagnosticsEngine::Ignored: return CXDiagnostic_Ignored;
>       case DiagnosticsEngine::Note:    return CXDiagnostic_Note;
> +    case DiagnosticsEngine::Remark:  return CXDiagnostic_Remark;
>       case DiagnosticsEngine::Warning: return CXDiagnostic_Warning;
>       case DiagnosticsEngine::Error:   return CXDiagnostic_Error;
>       case DiagnosticsEngine::Fatal:   return CXDiagnostic_Fatal;
>
> Modified: cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp?rev=202475&r1=202474&r2=202475&view=diff
> ==============================================================================
> --- cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp (original)
> +++ cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp Fri Feb 28 03:11:08 2014
> @@ -472,6 +472,11 @@ static bool isError(const Record &Diag)
>     return ClsName == "CLASS_ERROR";
>   }
>   
> +static bool isRemark(const Record &Diag) {
> +  const std::string &ClsName = Diag.getValueAsDef("Class")->getName();
> +  return ClsName == "CLASS_REMARK";
> +}
> +
>   /// ClangDiagsDefsEmitter - The top-level class emits .def files containing
>   /// declarations of Clang diagnostics.
>   namespace clang {
> @@ -518,6 +523,14 @@ void EmitClangDiagsDefs(RecordKeeper &Re
>         }
>       }
>   
> +    // Check that all remarks have an associated diagnostic group.
> +    if (isRemark(R)) {
> +      if (!isa<DefInit>(R.getValueInit("Group"))) {
> +        PrintFatalError(R.getLoc(), "Error " + R.getName() +
> +                                        " not in any diagnostic group");
> +      }
> +    }
> +
>       // Filter by component.
>       if (!Component.empty() && Component != R.getValueAsString("Component"))
>         continue;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-- 
http://www.nuanti.com
the browser experts




More information about the cfe-commits mailing list