From: Chris Lattner Date: Mon, 24 May 2010 21:35:18 +0000 (+0000) Subject: push categories forward a bit more: document them, add some X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f14538ec2651b5a2e02fd5e80d0b8886f52eb46;p=clang push categories forward a bit more: document them, add some major buckets to catch parser and sema issues, add inline asm category, and make diag groups take precedence over the sweeping categories just added. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104561 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/UsersManual.html b/docs/UsersManual.html index 4ba00e0b9a..5c5f6f916c 100644 --- a/docs/UsersManual.html +++ b/docs/UsersManual.html @@ -36,6 +36,7 @@ td { @@ -417,9 +418,9 @@ it:

  • An option that indicates how to control the diagnostic (for diagnostics that support it) [-fdiagnostics-show-option].
  • -
  • A high-level category for the diagnostic for clients that want to group - diagnostics by class (for diagnostics that - support it) [A high-level category for the + diagnostic for clients that want to group diagnostics by class (for + diagnostics that support it) [-fdiagnostics-show-category].
  • The line of source code that the issue occurs on, along with a caret and ranges that indicate the important locations [

    For more information please see Formatting of Diagnostics.

    +

    Diagnostic Mappings

    All diagnostics are mapped into one of these 5 classes:

    @@ -448,7 +450,23 @@ Diagnostics.

  • Fatal
  • -

    Controlling Diagnostics via Command Line Flags

    +

    Diagnostic Categories

    + +

    Though not shown by default, diagnostics may each be associated with a + high-level category. This category is intended to make it possible to triage + builds that produce a large number of errors or warnings in a grouped way. +

    + +

    Categories are not shown by default, but they can be turned on with the +-fdiagnostics-show-category option. +When set to "name", the category is printed textually in the diagnostic +output. When it is set to "id", a category number is printed. The +mapping of category names to category id's can be obtained by running 'clang + --print-diagnostic-categories'. +

    + +

    Controlling Diagnostics via Command Line + Flags

    -W flags, -pedantic, etc

    diff --git a/include/clang/Basic/Diagnostic.td b/include/clang/Basic/Diagnostic.td index f6b5d9c5b3..fabf9ebb44 100644 --- a/include/clang/Basic/Diagnostic.td +++ b/include/clang/Basic/Diagnostic.td @@ -42,7 +42,10 @@ class InGroup { DiagGroup Group = G; } //class IsGroup { DiagGroup Group = DiagGroup; } -// This defines the diagnostic groups that have references to them. +// This defines all of the named diagnostic categories. +include "DiagnosticCategories.td" + +// This defines all of the named diagnostic groups. include "DiagnosticGroups.td" diff --git a/include/clang/Basic/DiagnosticASTKinds.td b/include/clang/Basic/DiagnosticASTKinds.td index cc89c7caec..d755d99e6b 100644 --- a/include/clang/Basic/DiagnosticASTKinds.td +++ b/include/clang/Basic/DiagnosticASTKinds.td @@ -14,17 +14,20 @@ let Component = "AST" in { def note_expr_divide_by_zero : Note<"division by zero">; // inline asm related. -def err_asm_invalid_escape : Error< - "invalid %% escape in inline assembly string">; -def err_asm_unknown_symbolic_operand_name : Error< - "unknown symbolic operand name in inline assembly string">; +let CategoryName = "Inline Assembly Issue" in { + def err_asm_invalid_escape : Error< + "invalid %% escape in inline assembly string">; + def err_asm_unknown_symbolic_operand_name : Error< + "unknown symbolic operand name in inline assembly string">; + + def err_asm_unterminated_symbolic_operand_name : Error< + "unterminated symbolic operand name in inline assembly string">; + def err_asm_empty_symbolic_operand_name : Error< + "empty symbolic operand name in inline assembly string">; + def err_asm_invalid_operand_number : Error< + "invalid operand number in inline asm string">; +} -def err_asm_unterminated_symbolic_operand_name : Error< - "unterminated symbolic operand name in inline assembly string">; -def err_asm_empty_symbolic_operand_name : Error< - "empty symbolic operand name in inline assembly string">; -def err_asm_invalid_operand_number : Error< - "invalid operand number in inline asm string">; // Importing ASTs def err_odr_variable_type_inconsistent : Error< diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index b731030670..c7cad7395c 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -16,7 +16,8 @@ def err_fe_error_backend : Error<"error in backend: %0">, DefaultFatal; def err_fe_invalid_ast_file : Error<"invalid AST file: '%0'">, DefaultFatal; def err_fe_invalid_ast_action : Error<"invalid action for AST input">, DefaultFatal; -def err_fe_inline_asm : Error<"%0">; // Error generated by the backend. +// Error generated by the backend. +def err_fe_inline_asm : Error<"%0">, CatInlineAsm; def note_fe_inline_asm_here : Note<"generated from here">; def err_fe_invalid_code_complete_file : Error< "cannot locate code-completion file %0">, DefaultFatal; diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td index b8ed0ceb08..7cedd88042 100644 --- a/include/clang/Basic/DiagnosticParseKinds.td +++ b/include/clang/Basic/DiagnosticParseKinds.td @@ -13,9 +13,12 @@ let Component = "Parse" in { -def w_asm_qualifier_ignored : Warning<"ignored %0 qualifier on asm">; +def w_asm_qualifier_ignored : Warning<"ignored %0 qualifier on asm">, + CatInlineAsm; def warn_file_asm_volatile : Warning< - "meaningless 'volatile' on asm outside function">; + "meaningless 'volatile' on asm outside function">, CatInlineAsm; + +let CategoryName = "Parse Issue" in { def ext_empty_source_file : Extension<"ISO C forbids an empty source file">; def ext_top_level_semi : Extension< @@ -131,7 +134,7 @@ def err_label_end_of_compound_statement : Error< "label at end of compound statement: expected statement">; def err_expected_string_literal : Error<"expected string literal">; def err_expected_asm_operand : Error< - "expected string literal or '[' for asm operand">; + "expected string literal or '[' for asm operand">, CatInlineAsm; def err_expected_selector_for_method : Error< "expected selector for Objective-C method">; def err_expected_property_name : Error<"expected property name">; @@ -373,4 +376,5 @@ def warn_pragma_unused_expected_var : Warning< def warn_pragma_unused_expected_punc : Warning< "expected ')' or ',' in '#pragma unused'">; +} // end of Parse Issue category. } // end of Parser diagnostics diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 4d5f094b74..bdbb36761b 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// let Component = "Sema" in { +let CategoryName = "Semantic Issue" in { // Constant expressions def err_expr_not_ice : Error< @@ -2580,31 +2581,35 @@ def warn_unused_call : Warning< def err_incomplete_type_used_in_type_trait_expr : Error< "incomplete type %0 used in type trait expression">; def err_expected_ident_or_lparen : Error<"expected identifier or '('">; - -// inline asm. -def err_asm_wide_character : Error<"wide string is invalid in 'asm'">; -def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">; -def err_asm_invalid_output_constraint : Error< - "invalid output constraint '%0' in asm">; -def err_asm_invalid_lvalue_in_input : Error< - "invalid lvalue in asm input for constraint '%0'">; -def err_asm_invalid_input_constraint : Error< - "invalid input constraint '%0' in asm">; -def err_asm_invalid_type_in_input : Error< - "invalid type %0 in asm input for constraint '%1'">; -def err_asm_tying_incompatible_types : Error< - "unsupported inline asm: input with type %0 matching output with type %1">; -def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">; -def err_invalid_asm_cast_lvalue : Error< - "invalid use of a cast in a inline asm context requiring an l-value: " - "remove the cast or build with -fheinous-gnu-extensions">; - -def warn_invalid_asm_cast_lvalue : Warning< - "invalid use of a cast in a inline asm context requiring an l-value: " - "accepted due to -fheinous-gnu-extensions, but clang may remove support " - "for this in the future">; +} // End of general sema category. +// inline asm. +let CategoryName = "Inline Assembly Issue" in { + def err_asm_wide_character : Error<"wide string is invalid in 'asm'">; + def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">; + def err_asm_invalid_output_constraint : Error< + "invalid output constraint '%0' in asm">; + def err_asm_invalid_lvalue_in_input : Error< + "invalid lvalue in asm input for constraint '%0'">; + def err_asm_invalid_input_constraint : Error< + "invalid input constraint '%0' in asm">; + def err_asm_invalid_type_in_input : Error< + "invalid type %0 in asm input for constraint '%1'">; + def err_asm_tying_incompatible_types : Error< + "unsupported inline asm: input with type %0 matching output with type %1">; + def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">; + def err_invalid_asm_cast_lvalue : Error< + "invalid use of a cast in a inline asm context requiring an l-value: " + "remove the cast or build with -fheinous-gnu-extensions">; + + def warn_invalid_asm_cast_lvalue : Warning< + "invalid use of a cast in a inline asm context requiring an l-value: " + "accepted due to -fheinous-gnu-extensions, but clang may remove support " + "for this in the future">; +} + +let CategoryName = "Semantic Issue" in { def err_invalid_conversion_between_vectors : Error< "invalid conversion between vector type %0 and %1 of different size">; @@ -3082,6 +3087,6 @@ def err_undeclared_protocol_suggest : Error< def note_base_class_specified_here : Note< "base class %0 specified here">; -} - +} // end of sema category +} // end of sema component.