[cfe-commits] r69192 - in /cfe/trunk/include/clang/Basic: Diagnostic.td DiagnosticCommonKinds.td DiagnosticLexKinds.td DiagnosticSemaKinds.td

Chris Lattner sabre at nondot.org
Wed Apr 15 11:08:56 PDT 2009


Author: lattner
Date: Wed Apr 15 13:08:55 2009
New Revision: 69192

URL: http://llvm.org/viewvc/llvm-project?rev=69192&view=rev
Log:
annotate diagnostics with which groups they belong to.  Each 
diagnostic can belong to at most one group.  Each group can
contain multiple diags, but we have nice syntax for the common
case of "1 diag to one group".

Modified:
    cfe/trunk/include/clang/Basic/Diagnostic.td
    cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
    cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td

Modified: cfe/trunk/include/clang/Basic/Diagnostic.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.td?rev=69192&r1=69191&r2=69192&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.td (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.td Wed Apr 15 13:08:55 2009
@@ -26,25 +26,25 @@
 def CLASS_EXTENSION : DiagClass;
 def CLASS_ERROR     : DiagClass;
 
+// Diagnostic Groups.
+class DiagGroup<string name>;
+class InGroup<DiagGroup Group> { DiagGroup Group = Group; }
+class IsGroup<string Name> { DiagGroup Group = DiagGroup<Name>; }
+
+def ImplicitFunctionDeclare : DiagGroup<"implicit-function-declaration">;
+def Trigraphs : DiagGroup<"trigraphs">;
 
-/*
-class Option<string name, list<OptionControlled> members> : OptionControlled {
-  string Name = name;
-  list<OptionControlled> Members = members;
-}
 
-// Definitions for options ("warning groups").
-include "DiagnosticOptions.td"
 
-*/
 
 // All diagnostics emitted by the compiler are an indirect subclass of this.
 class Diagnostic<string text, DiagClass DC, DiagMapping defaultmapping> {
   /// Component is specified by the file with a big let directive.
-  string Component = ?;
-  string Text = text;
-  DiagClass Class = DC;
+  string      Component = ?;
+  string      Text = text;
+  DiagClass   Class = DC;
   DiagMapping DefaultMapping = defaultmapping;
+  DiagGroup   Group;
 }
 
 class Error<string str>     : Diagnostic<str, CLASS_ERROR, MAP_ERROR>;

Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=69192&r1=69191&r2=69192&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Wed Apr 15 13:08:55 2009
@@ -52,12 +52,14 @@
   "subexpression not valid in an integer constant expression">;
 
 // Driver
-def pp_macro_not_used : Warning<"macro is not used">, DefaultIgnore;
+def pp_macro_not_used : Warning<"macro is not used">, DefaultIgnore,
+    IsGroup<"unused-macros">;
 
 
 def err_pp_I_dash_not_supported : Error<
   "-I- not supported, please use -iquote instead">;
 def warn_pp_undef_identifier : Warning<
-  "%0 is not defined, evaluates to 0">, DefaultIgnore;
+  "%0 is not defined, evaluates to 0">,
+  IsGroup<"undef">, DefaultIgnore;
 
 }

Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=69192&r1=69191&r2=69192&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Wed Apr 15 13:08:55 2009
@@ -23,11 +23,13 @@
   "backslash and newline separated by space">;
 
 // Trigraphs.
-def trigraph_ignored : Warning<"trigraph ignored">;
+def trigraph_ignored : Warning<"trigraph ignored">, InGroup<Trigraphs>;
 def trigraph_ignored_block_comment : Warning<
-  "ignored trigraph would end block comment">;
-def trigraph_ends_block_comment : Warning<"trigraph ends block comment">;
-def trigraph_converted : Warning<"trigraph converted to '%0' character">;
+  "ignored trigraph would end block comment">, InGroup<Trigraphs>;
+def trigraph_ends_block_comment : Warning<"trigraph ends block comment">,
+    InGroup<Trigraphs>;
+def trigraph_converted : Warning<"trigraph converted to '%0' character">,
+    InGroup<Trigraphs>;
 
 def ext_multi_line_bcpl_comment : Extension<"multi-line // comment">;
 def ext_bcpl_comment : Extension<
@@ -112,8 +114,10 @@
 def ext_pp_include_next_directive : Extension<
   "#include_next is a language extension">;
 def ext_pp_warning_directive : Extension<"#warning is a language extension">;
+
 def ext_pp_extra_tokens_at_eol : ExtWarn<
-  "extra tokens at end of #%0 directive">;
+  "extra tokens at end of #%0 directive">, IsGroup<"extra-tokens">;
+  
 def ext_pp_comma_expr : Extension<"comma operator in operand of #if">;
 def ext_pp_bad_vaargs_use : Extension<
   "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro">;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=69192&r1=69191&r2=69192&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Apr 15 13:08:55 2009
@@ -76,8 +76,14 @@
 def err_parameter_name_omitted : Error<"parameter name omitted">;
 def warn_decl_in_param_list : Warning<
   "declaration of %0 will not be visible outside of this function">;
+  
 def warn_implicit_function_decl : Warning<
-  "implicit declaration of function %0">, DefaultIgnore;
+  "implicit declaration of function %0">,
+  InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
+def ext_implicit_function_decl : Extension<
+  "implicit declaration of function %0 is invalid in C99">,
+  InGroup<ImplicitFunctionDeclare>;
+
 def err_ellipsis_first_arg : Error<
   "ISO C requires a named argument before '...'">;
 def err_declarator_need_ident : Error<"declarator requires an identifier">;
@@ -221,7 +227,8 @@
   "synthesized properties %0 and %1 both claim ivar %2">;
 def error_property_implemented : Error<"property %0 is already implemented">;
 def warn_objc_property_attr_mutually_exclusive : Warning<
-  "property attributes '%0' and '%1' are mutually exclusive">, DefaultIgnore;
+  "property attributes '%0' and '%1' are mutually exclusive">,
+  IsGroup<"readonly-setter-attrs">, DefaultIgnore;
 
 // C++ declarations
 def err_static_assert_expression_is_not_constant : Error<
@@ -718,12 +725,14 @@
   "unexpected namespace name %0: expected expression">;
 def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
 def err_undeclared_use : Error<"use of undeclared '%0'">;
-def warn_deprecated : Warning<"%0 is deprecated">;
+def warn_deprecated : Warning<"%0 is deprecated">,
+    IsGroup<"deprecated-declarations">;
 def warn_unavailable : Warning<"%0 is unavailable">;
 def note_unavailable_here : Note<
   "function has been explicitly marked %select{unavailable|deleted}0 here">;
 def warn_missing_prototype : Warning<
-  "no previous prototype for function %0">, DefaultIgnore;
+  "no previous prototype for function %0">,
+  IsGroup<"missing-prototypes">, DefaultIgnore;
 def err_redefinition : Error<"redefinition of %0">;
 def err_static_non_static : Error<
   "static declaration of %0 follows non-static declaration">;
@@ -819,8 +828,6 @@
 
 def err_goto_into_scope : Error<"illegal jump (scoping violation)">;
 
-def ext_implicit_function_decl : Extension<
-  "implicit declaration of function %0 is invalid in C99">;
 
 def err_func_returning_array_function : Error<
   "function cannot return array or function type %0">;
@@ -883,7 +890,8 @@
 def ext_offsetof_extended_field_designator : Extension<
   "using extended field designator is an extension">;
 def warn_floatingpoint_eq : Warning<
-  "comparing floating point with == or != is unsafe">, DefaultIgnore;
+  "comparing floating point with == or != is unsafe">,
+  IsGroup<"float-equal">, DefaultIgnore;
 
 def err_typecheck_subscript_value : Error<
   "subscripted value is neither array nor pointer">;
@@ -987,7 +995,8 @@
 def err_value_init_for_array_type : Error<
   "array types cannot be value-initialized">;
 def warn_printf_not_string_constant : Warning<
-  "format string is not a string literal (potentially insecure)">;
+  "format string is not a string literal (potentially insecure)">,
+  IsGroup<"format-nonliteral">;
 
 def err_unexpected_interface : Error<
   "unexpected interface name %0: expected expression">;
@@ -1158,7 +1167,8 @@
 def ext_typecheck_convert_pointer_void_func : Extension<
   "%2 %1 converts between void* and function pointer, expected %0">;
 def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
-  "pointer types point to integer types with different sign %2 %1, expected %0">;
+ "pointer types point to integer types with different sign %2 %1, expected %0">,
+  IsGroup<"pointer-sign">;
 def ext_typecheck_convert_incompatible_pointer : ExtWarn<
   "incompatible pointer types %2 %1, expected %0">;
 def ext_typecheck_convert_discards_qualifiers : ExtWarn<





More information about the cfe-commits mailing list