<ul>
<li><a href="#diagnostics_display">Controlling How Clang Displays Diagnostics</a></li>
<li><a href="#diagnostics_mappings">Diagnostic Mappings</a></li>
+ <li><a href="#diagnostics_categories">Diagnostic Categories</a><li>
<li><a href="#diagnostics_commandline">Controlling Diagnostics via Command Line Flags</a></li>
<li><a href="#diagnostics_pragmas">Controlling Diagnostics via Pragmas</a></li>
</ul>
<li>An option that indicates how to control the diagnostic (for diagnostics that
support it) [<a
href="#opt_fdiagnostics-show-option">-fdiagnostics-show-option</a>].</li>
-<li>A high-level category for the diagnostic for clients that want to group
- diagnostics by class (for diagnostics that
- support it) [<a
+<li>A <a href="#diagnostics_categories">high-level category</a> for the
+ diagnostic for clients that want to group diagnostics by class (for
+ diagnostics that support it) [<a
href="#opt_fdiagnostics-show-category">-fdiagnostics-show-category</a>].</li>
<li>The line of source code that the issue occurs on, along with a caret and
ranges that indicate the important locations [<a
<p>For more information please see <a href="#cl_diag_formatting">Formatting of
Diagnostics</a>.</p>
+
<h4 id="diagnostics_mappings">Diagnostic Mappings</h4>
<p>All diagnostics are mapped into one of these 5 classes:</p>
<li>Fatal</li>
</ul></p>
-<h4 id="diagnostics_commandline">Controlling Diagnostics via Command Line Flags</h4>
+<h4 id="diagnostics_categories">Diagnostic Categories</h4>
+
+<p>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.
+</p>
+
+<p>Categories are not shown by default, but they can be turned on with the
+<a href="#opt_fdiagnostics-show-category">-fdiagnostics-show-category</a> option.
+When set to "<tt>name</tt>", the category is printed textually in the diagnostic
+output. When it is set to "<tt>id</tt>", a category number is printed. The
+mapping of category names to category id's can be obtained by running '<tt>clang
+ --print-diagnostic-categories</tt>'.
+</p>
+
+<h4 id="diagnostics_commandline">Controlling Diagnostics via Command Line
+ Flags</h4>
<p>-W flags, -pedantic, etc</p>
//class IsGroup<string Name> { DiagGroup Group = DiagGroup<Name>; }
-// 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"
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<
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;
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<
"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">;
def warn_pragma_unused_expected_punc : Warning<
"expected ')' or ',' in '#pragma unused'">;
+} // end of Parse Issue category.
} // end of Parser diagnostics
//===----------------------------------------------------------------------===//
let Component = "Sema" in {
+let CategoryName = "Semantic Issue" in {
// Constant expressions
def err_expr_not_ice : Error<
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">;
def note_base_class_specified_here : Note<
"base class %0 specified here">;
-}
-
+} // end of sema category
+} // end of sema component.