From b1c4d5507fada6c91f0aa78af0e7c6a9baa453fc Mon Sep 17 00:00:00 2001 From: Sebastian Redl Date: Wed, 4 Mar 2009 20:49:43 +0000 Subject: [PATCH] The basic representation of diagnostics information in tablegen format, plus (uncommented and incomplete) test conversions of the existing def files to this format. llvm-svn: 66064 --- clang/include/clang/Basic/Diagnostic.td | 41 ++ .../include/clang/Basic/DiagnosticASTKinds.td | 16 + .../clang/Basic/DiagnosticAnalysisKinds.td | 14 + .../clang/Basic/DiagnosticCommonKinds.td | 52 +++ .../include/clang/Basic/DiagnosticLexKinds.td | 210 +++++++++ .../clang/Basic/DiagnosticParseKinds.td | 228 ++++++++++ .../clang/Basic/DiagnosticSemaKinds.td | 428 ++++++++++++++++++ 7 files changed, 989 insertions(+) create mode 100644 clang/include/clang/Basic/Diagnostic.td create mode 100644 clang/include/clang/Basic/DiagnosticASTKinds.td create mode 100644 clang/include/clang/Basic/DiagnosticAnalysisKinds.td create mode 100644 clang/include/clang/Basic/DiagnosticCommonKinds.td create mode 100644 clang/include/clang/Basic/DiagnosticLexKinds.td create mode 100644 clang/include/clang/Basic/DiagnosticParseKinds.td create mode 100644 clang/include/clang/Basic/DiagnosticSemaKinds.td diff --git a/clang/include/clang/Basic/Diagnostic.td b/clang/include/clang/Basic/Diagnostic.td new file mode 100644 index 000000000000..27f890bdce06 --- /dev/null +++ b/clang/include/clang/Basic/Diagnostic.td @@ -0,0 +1,41 @@ +//===--- Diagnostic.td - C Language Family Diagnostic Handling ------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the TableGen core definitions for the diagnostics +// and diagnostic control. +// +//===----------------------------------------------------------------------===// + +// All diagnostics emitted by the compiler are an indirect subclass of this. +class Diagnostic { + string Component = ?; + string Text = text; +} + +class Error : Diagnostic; +class Note : Diagnostic; + +// Anything that can be controlled by an option subclasses this. +class OptionControlled; + +class Warning : Diagnostic, OptionControlled { + string DefaultMapping = "warning"; +} +// Special cases of warnings. +class Extension : Warning { + let DefaultMapping = "ignore"; +} +class ExtWarn : Warning; + + + +class Option members> : OptionControlled { + string Name = name; + list Members = members; +} diff --git a/clang/include/clang/Basic/DiagnosticASTKinds.td b/clang/include/clang/Basic/DiagnosticASTKinds.td new file mode 100644 index 000000000000..9c48bd960036 --- /dev/null +++ b/clang/include/clang/Basic/DiagnosticASTKinds.td @@ -0,0 +1,16 @@ +//==--- DiagnosticASTKinds.td - libast diagnostics ------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +let Component = "AST" in { + +def note_comma_in_ice : Note< + "C does not permit evaluated commas in an integer constant expression">; +def note_expr_divide_by_zero : Note<"division by zero">; + +} diff --git a/clang/include/clang/Basic/DiagnosticAnalysisKinds.td b/clang/include/clang/Basic/DiagnosticAnalysisKinds.td new file mode 100644 index 000000000000..2ed85fabea08 --- /dev/null +++ b/clang/include/clang/Basic/DiagnosticAnalysisKinds.td @@ -0,0 +1,14 @@ +//==--- DiagnosticAnalysisKinds.td - libanalysis diagnostics --------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +let Component = "Analysis" in { + +def warn_uninit_val : Warning<"use of uninitialized variable">; + +} diff --git a/clang/include/clang/Basic/DiagnosticCommonKinds.td b/clang/include/clang/Basic/DiagnosticCommonKinds.td new file mode 100644 index 000000000000..33852f1686d1 --- /dev/null +++ b/clang/include/clang/Basic/DiagnosticCommonKinds.td @@ -0,0 +1,52 @@ +//==--- DiagnosticCommonKinds.td - common diagnostics --------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +//===----------------------------------------------------------------------===// +// Common Helpers +//===----------------------------------------------------------------------===// + +let Component = "Common" in { + +def note_previous_definition : Note<"previous definition is here">; +def note_previous_declaration : Note<"previous declaration is here">; +def note_previous_implicit_declaration : Note< + "previous implicit declaration is here">; +def note_previous_use : Note<"previous use is here">; +def note_duplicate_case_prev : Note<"previous case defined here">; +def note_forward_declaration : Note<"forward declaration of %0">; +def note_type_being_defined : Note< + "definition of %0 is not complete until the closing '}'">; +def note_matching : Note<"to match this '%0'">; +def note_using_decl : Note<"using">; +def note_also_found_decl : Note<"also found">; + +def err_expected_colon : Error<"expected ':'">; + +def err_no_declarators : Error<"declaration does not declare anything">; +def err_param_redefinition : Error<"redefinition of parameter %0">; +def err_invalid_storage_class_in_func_decl : Error< + "invalid storage class specifier in function declarator">; +def err_expected_namespace_name : Error<"expected namespace name">; + +def ext_longlong : Extension< + "'long long' is an extension when C99 mode is not enabled">; +def warn_integer_too_large : Warning< + "integer constant is too large for its type">; +def warn_integer_too_large_for_signed : Warning< + "integer constant is so large that it is unsigned">; + +def note_invalid_subexpr_in_ice : Note< + "subexpression not valid in an integer constant expression">; + +def pp_macro_not_used : Warning<"macro is not used">; +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">; + +} diff --git a/clang/include/clang/Basic/DiagnosticLexKinds.td b/clang/include/clang/Basic/DiagnosticLexKinds.td new file mode 100644 index 000000000000..2db2b0f36578 --- /dev/null +++ b/clang/include/clang/Basic/DiagnosticLexKinds.td @@ -0,0 +1,210 @@ +//==--- DiagnosticLexKinds.td - liblex diagnostics ------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +//===----------------------------------------------------------------------===// +// Lexer Diagnostics +//===----------------------------------------------------------------------===// + +let Component = "Lex" in { + +def null_in_string : Warning<"null character(s) preserved in string literal">; +def null_in_char : Warning<"null character(s) preserved in character literal">; +def null_in_file : Warning<"null character ignored">; +def warn_nested_block_comment : Warning<"'/*' within block comment">; +def escaped_newline_block_comment_end : Warning< + "escaped newline between */ characters at block comment end">; +def backslash_newline_space : Warning< + "backslash and newline separated by space">; + +def trigraph_ignored : Warning<"trigraph ignored">; +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">; + +def ext_multi_line_bcpl_comment : Extension<"multi-line // comment">; +def ext_bcpl_comment : Extension< + "// comments are not allowed in this language">; +def ext_no_newline_eof : Extension<"no newline at end of file">; +def ext_backslash_newline_eof : Extension<"backslash-newline at end of file">; +def ext_dollar_in_identifier : Extension<"'$' in identifier">; +def charize_microsoft_ext : Extension<"@# is a microsoft extension">; + +def ext_token_used : Extension<"extension used">; + +def err_unterminated_string : Error<"missing terminating '\"' character">; +def err_unterminated_char : Error<"missing terminating ' character">; +def err_unterminated_angled_string : Error<"missing terminating '>' character">; +def err_empty_character : Error<"empty character constant">; +def err_unterminated_block_comment : Error<"unterminated /* comment">; +def err_invalid_character_to_charify : Error< + "invalid argument to convert to character">; + +def ext_nonstandard_escape : Extension< + "use of non-standard escape character '\\%0'">; +def ext_unknown_escape : Extension<"unknown escape sequence '\\%0'">; +def err_hex_escape_no_digits : Error<"\\x used with no following hex digits">; +def err_invalid_decimal_digit : Error<"invalid digit '%0' in decimal constant">; +def err_invalid_binary_digit : Error<"invalid digit '%0' in binary constant">; +def err_invalid_octal_digit : Error<"invalid digit '%0' in octal constant">; +def err_invalid_suffix_integer_constant : Error< + "invalid suffix '%0' on integer constant">; +def err_invalid_suffix_float_constant : Error< + "invalid suffix '%0' on floating constant">; +def warn_extraneous_wide_char_constant : Warning< + "extraneous characters in wide character constant ignored">; +def warn_char_constant_too_large : Warning< + "character constant too long for its type">; +def err_exponent_has_no_digits : Error<"exponent has no digits">; +def ext_imaginary_constant : Extension<"imaginary constants are an extension">; +def err_hexconstant_requires_exponent : Error< + "hexadecimal floating constants require an exponent">; +def ext_hexconstant_invalid : Extension< + "hexadecimal floating constants are a C99 feature">; +def ext_binary_literal : Extension<"binary integer literals are an extension">; +def err_pascal_string_too_long : Error<"Pascal string is too long">; +def warn_octal_escape_too_large : ExtWarn<"octal escape sequence out of range">; +def warn_hex_escape_too_large : ExtWarn<"hex escape sequence out of range">; + + +def pp_hash_warning : Warning<"#warning%0">; +def pp_include_next_in_primary : Warning< + "#include_next in primary source file">; +def pp_include_next_absolute_path : Warning<"#include_next with absolute path">; +def ext_c99_whitespace_required_after_macro_name : Warning< + "ISO C99 requires whitespace after the macro name">; +def pp_pragma_once_in_main_file : Warning<"#pragma once in main file">; +def pp_pragma_sysheader_in_main_file : Warning< + "#pragma system_header ignored in main file">; +def pp_poisoning_existing_macro : Warning<"poisoning existing macro">; +def pp_out_of_date_dependency : Warning< + "current file is older than dependency %0">; +def pp_undef_builtin_macro : Warning<"undefining builtin macro">; +def pp_redef_builtin_macro : Warning<"redefining builtin macro">; +def pp_invalid_string_literal : Warning< + "invalid string literal, ignoring final '\\'">; +def warn_pp_expr_overflow : Warning< + "integer overflow in preprocessor expression">; +def warn_pp_convert_lhs_to_positive : Warning< + "left side of operator converted from negative value to unsigned: %0">; +def warn_pp_convert_rhs_to_positive : Warning< + "right side of operator converted from negative value to unsigned: %0">; + +def ext_pp_import_directive : Extension<"#import is a language extension">; +def ext_pp_ident_directive : Extension<"#ident is a language extension">; +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 : Extension< + "extra tokens at end of %0 directive">; +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">; +def ext_pp_macro_redef : Extension<"%0 macro redefined">; +def ext_variadic_macro : Extension<"variadic macros were introduced in C99">; +def ext_named_variadic_macro : Extension< + "named variadic macros are a GNU extension">; +def ext_embedded_directive : Extension< + "embedding a directive within macro arguments is not portable">; +def ext_missing_varargs_arg : Extension< + "varargs argument missing, but tolerated as an extension">; +def ext_empty_fnmacro_arg : Extension< + "empty macro arguments were standardized in C99">; + +def ext_pp_base_file : Extension<"__BASE_FILE__ is a language extension">; +def ext_pp_include_level : Extension< + "__INCLUDE_LEVEL__ is a language extension">; +def ext_pp_timestamp : Extension<"__TIMESTAMP__ is a language extension">; + +def err_pp_invalid_directive : Error<"invalid preprocessing directive">; +def err_pp_hash_error : Error<"#error%0">; +def err_pp_file_not_found : Error<"'%0' file not found">; +def err_pp_empty_filename : Error<"empty filename">; +def err_pp_include_too_deep : Error<"#include nested too deeply">; +def err_pp_expects_filename : Error<"expected \"FILENAME\" or ">; +def err_pp_macro_not_identifier : Error<"macro names must be identifiers">; +def err_pp_missing_macro_name : Error<"macro name missing">; +def err_pp_missing_rparen_in_macro_def : Error< + "missing ')' in macro parameter list">; +def err_pp_invalid_tok_in_arg_list : Error< + "invalid token in macro parameter list">; +def err_pp_expected_ident_in_arg_list : Error< + "expected identifier in macro parameter list">; +def err_pp_expected_comma_in_arg_list : Error< + "expected comma in macro parameter list">; +def err_pp_duplicate_name_in_arg_list : Error< + "duplicate macro parameter name %0">; +def err_pp_stringize_not_parameter : Error< + "'#' is not followed by a macro parameter">; +def err_pp_malformed_ident : Error<"invalid #ident directive">; +def err_pp_unterminated_conditional : Error< + "unterminated conditional directive">; +def pp_err_else_after_else : Error<"#else after #else">; +def pp_err_elif_after_else : Error<"#elif after #else">; +def pp_err_else_without_if : Error<"#else without #if">; +def pp_err_elif_without_if : Error<"#elif without #if">; +def err_pp_endif_without_if : Error<"#endif without #if">; +def err_pp_expected_value_in_expr : Error<"expected value in expression">; +def err_pp_missing_val_before_operator : Error<"missing value before operator">; +def err_pp_expected_rparen : Error<"expected ')' in preprocessor expression">; +def err_pp_expected_eol : Error< + "expected end of line in preprocessor expression">; +def err_pp_defined_requires_identifier : Error< + "operator 'defined' requires an identifier">; +def err_pp_missing_rparen : Error<"missing ')' after 'defined'">; +def err_pp_colon_without_question : Error<"':' without preceding '?'">; +def err_pp_division_by_zero : Error< + "division by zero in preprocessor expression">; +def err_pp_remainder_by_zero : Error< + "remainder by zero in preprocessor expression">; +def err_pp_expr_bad_token_binop : Error< + "token is not a valid binary operator in a preprocessor subexpression">; +def err_pp_expr_bad_token_start_expr : Error< + "invalid token at start of a preprocessor expression">; +def err_pp_invalid_poison : Error<"can only poison identifier tokens">; +def err_pp_used_poisoned_id : Error<"attempt to use a poisoned identifier">; +def err__Pragma_malformed : Error< + "_Pragma takes a parenthesized string literal">; +def err_pragma_comment_malformed : Error< + "pragma comment requires parenthesized identifier and optional string">; +def err_pragma_comment_unknown_kind : Error<"unknown kind of pragma comment">; +def err_defined_macro_name : Error<"'defined' cannot be used as a macro name">; +def err_paste_at_start : Error< + "'##' cannot appear at start of macro expansion">; +def err_paste_at_end : Error<"'##' cannot appear at end of macro expansion">; +def ext_paste_comma : Extension< + "Use of comma pasting extension is non-portable">; +def err_unterm_macro_invoc : Error< + "unterminated function-like macro invocation">; +def err_too_many_args_in_macro_invoc : Error< + "too many arguments provided to function-like macro invocation">; +def err_too_few_args_in_macro_invoc : Error< + "too few arguments provided to function-like macro invocation">; +def err_pp_bad_paste : Error< + "pasting formed '%0', an invalid preprocessing token">; +def err_pp_operator_used_as_macro_name : Error< + "C++ operator '%0' cannot be used as a macro name">; +def err_pp_illegal_floating_literal : Error< + "floating point literal in preprocessor expression">; +def err_pp_line_requires_integer : Error< + "#line directive requires a positive integer argument">; +def err_pp_line_invalid_filename : Error< + "invalid filename for #line directive">; +def err_pp_linemarker_requires_integer : Error< + "line marker directive requires a positive integer argument">; +def err_pp_linemarker_invalid_filename : Error< + "invalid filename for line marker directive">; +def err_pp_linemarker_invalid_flag : Error< + "invalid flag line marker directive">; +def err_pp_linemarker_invalid_pop : Error< + "invalid line marker flag '2': cannot pop empty include stack">; +def ext_pp_line_too_big : Extension< + "C requires #line number to be less than %0, allowed as extension">; + +} diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td new file mode 100644 index 000000000000..fe38b6dbca46 --- /dev/null +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -0,0 +1,228 @@ +//==--- DiagnosticParseKinds.td - libparse diagnostics --------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +//===----------------------------------------------------------------------===// +// Parser Diagnostics +//===----------------------------------------------------------------------===// + +let Component = "Parse" in { + +def w_asm_qualifier_ignored : Warning<"ignored %0 qualifier on asm">; + +def ext_empty_source_file : Extension<"ISO C forbids an empty source file">; +def ext_top_level_semi : Extension< + "ISO C does not allow an extra ';' outside of a function">; +def ext_extra_struct_semi : Extension< + "ISO C does not allow an extra ';' inside a struct or union">; + +def ext_duplicate_declspec : Extension<"duplicate '%0' declaration specifier">; +def ext_plain_complex : Extension< + "ISO C does not support plain '_Complex' meaning '_Complex double'">; +def ext_integer_complex : Extension< + "ISO C does not support complex integer types">; +def ext_thread_before : Extension<"'__thread' before 'static'">; + +def ext_empty_struct_union_enum : Extension<"use of empty %0 extension">; + +def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">; +def err_invalid_short_spec : Error<"'short %0' is invalid">; +def err_invalid_long_spec : Error<"'long %0' is invalid">; +def err_invalid_longlong_spec : Error<"'long long %0' is invalid">; +def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">; +def err_invalid_thread_spec : Error<"'__thread %0' is invalid">; + +def ext_ident_list_in_param : Extension< + "type-less parameter names in function declaration">; +def ext_c99_variable_decl_in_for_loop : Extension< + "variable declaration in for loop is a C99-specific feature">; +def ext_c99_compound_literal : Extension< + "compound literals are a C99-specific feature">; +def ext_c99_enumerator_list_comma : Extension< + "commas at the end of enumerator lists are a C99-specific feature">; + +def ext_gnu_indirect_goto : Extension<"use of GNU indirect-goto extension">; +def ext_gnu_address_of_label : Extension< + "use of GNU address-of-label extension">; +def ext_gnu_statement_expr : Extension< + "use of GNU statement expression extension">; +def ext_gnu_conditional_expr : Extension< + "use of GNU ?: expression extension, eliding middle term">; +def ext_gnu_empty_initializer : Extension< + "use of GNU empty initializer extension">; +def ext_gnu_array_range : Extension<"use of GNU array range extension">; +def ext_gnu_missing_equal_designator : Extension< + "use of GNU 'missing =' extension in designator">; +def err_expected_equal_designator : Error<"expected '=' or another designator">; +def ext_gnu_old_style_field_designator : Extension< + "use of GNU old-style field designator extension">; +def ext_gnu_case_range : Extension<"use of GNU case range extension">; + +def err_parse_error : Error<"parse error">; +def err_expected_expression : Error<"expected expression">; +def err_expected_type : Error<"expected a type">; +def err_expected_external_declaration : Error<"expected external declaration">; +def err_expected_ident : Error<"expected identifier">; +def err_expected_ident_lparen : Error<"expected identifier or '('">; +def err_expected_ident_lbrace : Error<"expected identifier or '{'">; +def err_expected_lbrace : Error<"expected '{'">; +def err_expected_lparen : Error<"expected '('">; +def err_expected_rparen : Error<"expected ')'">; +def err_expected_rsquare : Error<"expected ']'">; +def err_expected_rbrace : Error<"expected '}'">; +def err_expected_greater : Error<"expected '>'">; +def err_expected_semi_decl_list : Error< + "expected ';' at end of declaration list">; +def ext_expected_semi_decl_list : Extension< + "expected ';' at end of declaration list">; +def err_function_declared_typedef : Error< + "function definition declared 'typedef'">; +def err_expected_fn_body : Error< + "expected function body after function declarator">; +def err_expected_method_body : Error<"expected method body">; +def err_invalid_token_after_toplevel_declarator : Error< + "invalid token after top level declarator">; +def err_expected_statement : Error<"expected statement">; +def err_expected_lparen_after : Error<"expected '(' after '%0'">; +def err_expected_lparen_after_id : Error<"expected '(' after %0">; +def err_expected_less_after : Error<"expected '<' after '%0'">; +def err_expected_comma : Error<"expected ','">; +def err_expected_lbrace_in_compound_literal : Error< + "expected '{' in compound literal">; +def err_expected_while : Error<"expected 'while' in do/while loop">; +def err_expected_semi_after : Error<"expected ';' after %0">; +def err_expected_semi_after_expr : Error<"expected ';' after expression">; +def err_expected_semi_after_method_proto : Error< + "expected ';' after method prototype">; +def err_expected_semi_for : Error<"expected ';' in 'for' statement specifier">; +def err_expected_colon_after : Error<"expected ':' after %0">; +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">; +def err_expected_selector_for_method : Error< + "expected selector for Objective-C method">; + +def err_unexpected_at : Error<"unexpected '@' in program">; + +def err_invalid_reference_qualifier_application : Error< + "'%0' qualifier may not be applied to a reference">; +def err_illegal_decl_reference_to_reference : Error< + "%0 declared as a reference to a reference">; +def err_argument_required_after_attribute : Error< + "argument required after attribute">; +def err_missing_param : Error<"expected parameter declarator">; +def err_unexpected_typedef_ident : Error< + "unexpected type name %0: expected identifier">; +def err_expected_class_name : Error<"expected class name">; +def err_unspecified_vla_size_with_static : Error< + "'static' may not be used with an unspecified variable length array size">; + +def err_typename_requires_specqual : Error< + "type name requires a specifier or qualifier">; +def err_typename_invalid_storageclass : Error< + "type name does not allow storage class to be specified">; +def err_typename_invalid_functionspec : Error< + "type name does not allow function specifier to be specified">; +def err_invalid_decl_spec_combination : Error< + "cannot combine with previous '%0' declaration specifier">; + +def err_objc_no_attributes_on_category : Error< + "attributes may not be specified on a category">; +def err_objc_missing_end : Error<"missing @end">; +def warn_objc_protocol_qualifier_missing_id : Warning< + "protocol qualifiers without 'id' is archaic">; + +def err_objc_illegal_visibility_spec : Error< + "illegal visibility specification">; +def err_objc_illegal_interface_qual : Error<"illegal interface qualifier">; +def err_objc_expected_equal : Error< + "setter/getter expects '=' followed by name">; +def err_objc_property_requires_field_name : Error< + "property requires fields to be named">; +def err_objc_property_bitfield : Error< + "property name cannot be a bitfield">; +def err_objc_expected_property_attr : Error<"unknown property attribute %0">; +def err_objc_propertoes_require_objc2 : Error< + "properties are an Objective-C 2 feature">; +def err_objc_unexpected_attr : Error< + "prefix attribute must be followed by an interface or protocol">; +def err_objc_directive_only_in_protocol : Error< + "directive may only be specified in protocols only">; +def err_missing_catch_finally : Error< + "@try statement without a @catch and @finally clause">; +def err_objc_concat_string : Error<"unexpected token after Objective-C string">; +def err_missing_sel_definition : Error<"cannot find definition of 'SEL'">; +def err_missing_id_definition : Error<"cannot find definition of 'id'">; +def err_missing_proto_definition : Error< + "cannot find definition of 'Protocol'">; +def err_missing_class_definition : Error<"cannot find definition of 'Class'">; +def warn_expected_implementation : Warning< + "@end must appear in an @implementation context">; +def error_property_ivar_decl : Error< + "property synthesize requires specification of an ivar">; + +def err_expected_field_designator : Error< + "expected a field designator, such as '.field = 4'">; + +def err_declaration_does_not_declare_param : Error< + "declaration does not declare a parameter">; +def err_no_matching_param : Error<"parameter named %0 is missing">; + +def err_expected_unqualified_id : Error<"expected unqualified-id">; +def err_func_def_no_params : Error< + "function definition does not declare parameters">; +def err_expected_lparen_after_type : Error< + "expected '(' for function-style cast or type construction">; +def err_expected_equal_after_declarator : Error< + "expected '=' after declarator">; +def warn_parens_disambiguated_as_function_decl : Warning< + "parentheses were disambiguated as a function declarator">; +def err_expected_member_or_base_name : Error< + "expected class member or base class name">; +def ext_ellipsis_exception_spec : Extension< + "exception specification of '...' is a Microsoft extension">; +def err_expected_catch : Error<"expected catch">; + +def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">; + +def err_operator_missing_type_specifier : Error< + "missing type specifier after 'operator'">; + +def err_anon_type_definition : Error< + "declaration of anonymous %0 must be a definition">; + +def err_expected_template : Error<"expected template">; +def err_expected_comma_greater : Error<"expected ',' or '>' in template-parameter-list">; +def err_expected_type_id_after : Error<"expected type-id after '%0'">; +def err_expected_class_before : Error<"expected 'class' before '%0'">; +def err_template_spec_syntax_non_template : Error< + "identifier followed by '<' indicates a class template specialization but %0 %select{does not refer to a template|refers to a function template||refers to a template template parameter}1">; +def err_id_after_template_in_nested_name_spec : Error< + "expected template name after 'template' keyword in nested name specifier">; +def err_less_after_template_name_in_nested_name_spec : Error< + "expected '<' after 'template %0' in nested name specifier">; +def err_two_right_angle_brackets_need_space : Error< + "a space is required between consecutive right angle brackets (use '> >')">; +def warn_cxx0x_right_shift_in_template_arg : Warning< + "use of right-shift operator ('>>') in template argument will require parentheses in C++0x">; + + +def warn_pragma_pack_expected_lparen : Warning< + "missing '(' after '#pragma pack' - ignoring">; +def warn_pragma_pack_expected_rparen : Warning< + "missing ')' after '#pragma pack' - ignoring">; +def warn_pragma_pack_invalid_action : Warning< + "unknown action for '#pragma pack' - ignored">; +def warn_pragma_pack_invalid_constant : Warning< + "invalid constant for '#pragma pack', expected %0 - ignored">; +def warn_pragma_pack_malformed : Warning< + "expected integer or identifier in '#pragma pack' - ignored">; + +} diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td new file mode 100644 index 000000000000..cec28a2a48f7 --- /dev/null +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -0,0 +1,428 @@ +//==--- DiagnosticSemaKinds.td - libsema diagnostics ----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Semantic Analysis +// +//===----------------------------------------------------------------------===// + +let Component = "Sema" in { + +def err_expr_not_ice : Error< + "expression is not an integer constant expression">; +def ext_expr_not_ice : Extension< + "expression is not integer constant expression (but is allowed as an extension)">; +def ext_null_pointer_expr_not_ice : Extension< + "null pointer expression is not an integer constant expression (but is allowed as an extension)">; + +def ext_predef_outside_function : Warning< + "predefined identifier is only valid inside function">; + +def err_array_designator_nonconstant : Error< + "array designator value must be a constant expression">; +def err_array_designator_negative : Error< + "array designator value '%0' is negative">; +def err_array_designator_empty_range : Error< + "array designator range [%0, %1] is empty">; +def err_array_designator_non_array : Error< + "array designator cannot initialize non-array type %0">; +def err_array_designator_too_large : Error< + "array designator index (%0) exceeds array bounds (%1)">; +def err_field_designator_non_aggr : Error< + "field designator cannot initialize a %select{non-struct, non-union|non-class}0 type %1">; +def err_field_designator_unknown : Error< + "field designator %0 does not refer to any field in type %1">; +def err_field_designator_nonfield : Error< + "field designator %0 does not refer to a non-static data member">; +def note_field_designator_found : Note<"field designator refers here">; +def err_field_designator_anon_class : Error< + "field designator %0 refers to a member of an anonymous %select{struct|class|union}1">; +def err_designator_for_scalar_init : Error< + "designator in initializer for scalar type %0">; +def warn_subobject_initializer_overrides : Warning< + "subobject initialization overrides initialization of other fields within its enclosing subobject">; +def warn_initializer_overrides : Warning< + "initializer overrides prior initialization of this subobject">; +def note_previous_initializer : Note< + "previous initialization %select{|with side effects }0is here%select{| (side effects may not occur at run time)}0">; +def err_designator_into_flexible_array_member : Error< + "designator into flexible array member subobject">; +def note_flexible_array_member : Note< + "initialized flexible array member %0 is here">; + +def ext_vla : Extension< + "variable length arrays are a C99 feature, accepted as an extension">; +def ext_anon_param_requires_type_specifier : Extension< + "type specifier required for unnamed parameter, defaults to int">; +def err_bad_variable_name : Error< + "'%0' cannot be the name of a variable or data member">; +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">; +def err_ellipsis_first_arg : Error< + "ISO C requires a named argument before '...'">; +def err_declarator_need_ident : Error<"declarator requires an identifier">; +def err_bad_language : Error<"unknown linkage language">; +def warn_use_out_of_scope_declaration : Warning< + "use of out-of-scope declaration of %0">; + +def ext_implicit_lib_function_decl : ExtWarn< + "implicitly declaring C library function '%0' with type %1">; +def note_please_include_header : Note< + "please include the header <%0> or explicitly provide a declaration for '%1'">; +def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">; +def err_implicit_decl_requires_stdio : Error< + "implicit declaration of '%0' requires inclusion of the header ">; +def warn_redecl_library_builtin : Warning< + "incompatible redeclaration of library function %0 will be ignored">; +def err_builtin_definition : Error<"definition of builtin function %0">; + +def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">; +def err_statically_allocated_object : Error< + "Objective-C type cannot be statically allocated">; +def err_object_cannot_be_by_value : Error< + "Objective-C type cannot be %0 by value">; +def warn_enum_value_overflow : Warning<"overflow in enumeration value">; + +def warn_pragma_pack_invalid_alignment : Warning< + "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">; +def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">; +def warn_pragma_pack_pop_identifer_and_alignment : Warning< + "specifying both a name and alignment to 'pop' is undefined">; +def warn_pragma_pack_pop_failed : Warning<"#pragma pack(pop, ...) failed: %0">; + +def err_duplicate_class_def : Error< + "duplicate interface definition for class %0">; +def err_undef_superclass : Error< + "cannot find interface declaration for %0, superclass of %1">; +def warn_previous_alias_decl : Warning<"previously declared alias is ignored">; +def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">; +def warn_undef_interface : Warning<"cannot find interface declaration for %0">; +def err_duplicate_protocol_def : Error<"duplicate protocol definition of %0">; +def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">; +def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">; +def warn_readonly_property : Warning< + "attribute 'readonly' of property %0 restricts attribute " "'readwrite' of property inherited from %1">; + +def warn_property_attribute : Warning< + "property %0 '%1' attribute does not match the property inherited from %2">; +def warn_property_types_are_incompatible : Warning< + "property type %0 is incompatible with type %1 inherited from %2">; +def err_undef_interface : Error<"cannot find interface declaration for %0">; +def warn_dup_category_def : Warning< + "duplicate definition of category %1 on interface %0">; +def err_conflicting_super_class : Error<"conflicting super class name %0">; +def err_dup_implementation_class : Error<"reimplementation of class %0">; +def err_conflicting_ivar_type : Error< + "instance variable %0 has conflicting type: %1 vs %2">; +def err_conflicting_ivar_bitwidth : Error< + "instance variable %0 has conflicting bitfield width">; +def err_conflicting_ivar_name : Error< + "conflicting instance variable names: %0 vs %1">; +def err_inconsistant_ivar_count : Error< + "inconsistent number of instance variables specified">; +def warn_incomplete_impl : Warning<"incomplete implementation">; +def warn_undef_method_impl : Warning<"method definition for %0 not found">; +def warn_conflicting_types : Warning<"conflicting types for %0">; +def warn_multiple_method_decl : Warning<"multiple methods named %0 found">; +def err_accessor_property_type_mismatch : Error< + "type of property %0 does not match type of accessor %1">; +def note_declared_at : Note<"declared at">; +def err_setter_type_void : Error<"type of setter must be void">; +def err_duplicate_method_decl : Error<"duplicate declaration of method %0">; +def error_missing_method_context : Error< + "missing context for method declaration">; +def err_objc_property_attr_mutually_exclusive : Error< + "property attributes '%0' and '%1' are mutually exclusive">; +def err_objc_property_requires_object : Error< + "property with '%0' attribute must be of object type">; +def warn_objc_property_no_assignment_attribute : Warning< + "no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed">; +def warn_objc_property_default_assign_on_object : Warning< + "default property attribute 'assign' not appropriate for non-gc object">; +def warn_property_attr_mismatch : Warning< + "property attribute in continuation class does not match the primary class">; +def err_use_continuation_class : Error< + "attribute of property in continuation class of %0 can only be 'readwrite'">; +def err_continuation_class : Error<"continuation class has no primary class">; +def err_property_type : Error<"property cannot have array or function type %0">; +def error_missing_property_context : Error< + "missing context for property implementation declaration">; +def error_bad_property_decl : Error< + "property implementation must have its declaration in interface %0">; +def error_synthesize_category_decl : Error< + "@synthesize not allowed in a category's implementation">; +def error_missing_property_interface : Error< + "property implementation in a category with no category declaration">; +def error_bad_category_property_decl : Error< + "property implementation must have its declaration in the category %0">; +def error_bad_property_context : Error< + "property implementation must be in a class or category implementation">; +def error_missing_property_ivar_decl : Error< + "synthesized property %0 must either be named the same as a compatible" " ivar or must explicitly name an ivar">; +def error_property_ivar_type : Error< + "type of property %0 does not match type of ivar %1">; +def error_weak_property : Error< + "existing ivar %1 for __weak property %0 must be __weak">; +def error_strong_property : Error< + "existing ivar %1 for a __strong property %0 must be garbage collectable">; +def error_dynamic_property_ivar_decl : Error< + "dynamic property can not have ivar specification">; +def error_duplicate_ivar_use : Error< + "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">; + +def err_storageclass_invalid_for_member : Error< + "storage class specified for a member declaration">; +def err_mutable_function : Error<"'mutable' cannot be applied to functions">; +def err_mutable_reference : Error<"'mutable' cannot be applied to references">; +def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">; +def err_mutable_nonmember : Error< + "'mutable' can only be applied to member variables">; +def err_virtual_non_function : Error< + "'virtual' can only appear on non-static member functions">; +def err_not_bitfield_type : Error<"cannot declare %0 to be a bit-field type">; +def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">; +def err_not_integral_type_bitfield : Error< + "bit-field %0 with non-integral type">; +def err_member_initialization : Error< + "%0 can only be initialized if it is a static const integral data member">; +def err_member_function_initialization : Error< + "initializer on function does not look like a pure-specifier">; +def err_non_virtual_pure : Error< + "%0 is not virtual and cannot be declared pure">; +def err_implicit_object_parameter_init : Error< + "cannot initialize object parameter of type %0 with an expression of type %1">; + +def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">; +def err_invalid_qualified_constructor : Error< + "'%0' qualifier is not allowed on a constructor">; +def err_constructor_return_type : Error< + "constructor cannot have a return type">; +def err_constructor_redeclared : Error<"constructor cannot be redeclared">; +def err_constructor_byvalue_arg : Error< + "copy constructor must pass its first argument by reference">; + +def err_destructor_not_member : Error< + "destructor must be a non-static member function">; +def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">; +def err_invalid_qualified_destructor : Error< + "'%0' qualifier is not allowed on a destructor">; +def err_destructor_return_type : Error<"destructor cannot have a return type">; +def err_destructor_redeclared : Error<"destructor cannot be redeclared">; +def err_destructor_with_params : Error<"destructor cannot have any parameters">; +def err_destructor_variadic : Error<"destructor cannot be variadic">; +def err_destructor_typedef_name : Error< + "destructor cannot be declared using a typedef %0 of the class name">; + +def err_not_reference_to_const_init : Error< + "non-const reference to type %0 cannot be initialized with a %1 of type %2">; +def err_reference_init_drops_quals : Error< + "initialization of reference to type %0 with a %1 of type %2 drops qualifiers">; +def err_reference_var_requires_init : Error< + "declaration of reference variable %0 requires an initializer">; +def err_const_var_requires_init : Error< + "declaration of const variable '%0' requires an initializer">; +def err_init_non_aggr_init_list : Error< + "initialization of non-aggregate type %0 with an initializer list">; +def err_init_reference_member_uninitialized : Error< + "reference member of type %0 uninitialized">; +def note_uninit_reference_member : Note< + "uninitialized reference member is here">; + +def err_objc_decls_may_only_appear_in_global_scope : Error< + "Objective-C declarations may only appear in global scope">; +def err_nsobject_attribute : Error< + "__attribute ((NSObject)) is for pointer types only">; + +def err_attribute_can_be_applied_only_to_symbol_declaration : Error< + "%0 attribute can be applied only to symbol declaration">; +def err_attributes_are_not_compatible : Error< + "%0 and %1 attributes are not compatible">; +def err_attribute_wrong_number_arguments : Error< + "attribute requires %0 argument(s)">; +def err_attribute_missing_parameter_name : Error< + "attribute requires unquoted parameter">; +def err_attribute_invalid_vector_type : Error<"invalid vector type %0">; +def err_attribute_argument_not_int : Error< + "'%0' attribute requires integer constant">; +def err_attribute_argument_n_not_int : Error< + "'%0' attribute requires parameter %1 to be an integer constant">; +def err_attribute_argument_n_not_string : Error< + "'%0' attribute requires parameter %1 to be a string">; +def err_attribute_argument_out_of_bounds : Error< + "'%0' attribute parameter %1 is out of bounds">; +def err_attribute_requires_objc_interface : Error< + "attribute may only be applied to an Objective-C interface">; +def err_nonnull_pointers_only : Error< + "nonnull attribute only applies to pointer arguments">; +def err_format_strftime_third_parameter : Error< + "strftime format attribute requires 3rd parameter to be 0">; +def err_format_attribute_requires_variadic : Error< + "format attribute requires variadic function">; +def err_format_attribute_not : Error<"format argument not %0">; +def err_attribute_invalid_size : Error< + "vector size not an integral multiple of component size">; +def err_attribute_zero_size : Error<"zero vector size">; +def err_typecheck_vector_not_convertable : Error< + "can't convert between vector values of different size (%0 and %1)">; +def err_typecheck_ext_vector_not_typedef : Error< + "ext_vector_type only applies to types, not variables">; +def err_ext_vector_component_exceeds_length : Error< + "vector component access exceeds type %0">; +def err_ext_vector_component_requires_even : Error< + "vector component access invalid for odd-sized type %0">; +def err_ext_vector_component_name_illegal : Error< + "illegal vector component name '%0'">; +def err_attribute_address_space_not_int : Error< + "address space attribute requires an integer constant">; +def err_attribute_address_multiple_qualifiers : Error< + "multiple address spaces specified for type">; +def err_implicit_pointer_address_space_cast : Error< + "illegal implicit cast between two pointers with different address spaces">; +def err_as_qualified_auto_decl : Error< + "automatic variable qualified with an address space">; +def err_attribute_annotate_no_string : Error< + "argument to annotate attribute was not a string literal">; +def err_attribute_aligned_not_power_of_two : Error< + "requested alignment is not a power of 2">; +def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning< + "'%0' redeclared without %1 attribute: previous %1 ignored">; +def warn_attribute_ignored : Warning<"%0 attribute ignored">; +def warn_attribute_weak_on_field : Warning< + "__weak attribute cannot be specified on a field declaration">; +def warn_attribute_weak_on_local : Warning< + "__weak attribute cannot be specified on an automatic variable">; +def warn_attribute_wrong_decl_type : Warning< + "'%0' attribute only applies to %select{function|union|" "variable and function|function or method}1 types">; +def warn_attribute_ignored_for_field_of_type : Warning< + "%0 attribute ignored for field of type %1">; +def warn_transparent_union_attribute_field_size : Warning< + "transparent_union attribute ignored, size of type %0 must match type of first field">; +def warn_transparent_union_attribute_not_difinition : Warning< + "transparent_union attribute ignored, union type must be defined">; +def warn_transparent_union_attribute_floating : Warning< + "transparent_union attribute ignored, first field cannot be a floating-point or vector type">; +def warn_transparent_union_attribute_zero_fields : Warning< + "transparent_union attribute ignored, the union does not contain any fields">; +def warn_transparent_union_attribute_not_c : Warning< + "transparent_union attribute ignored, attribute is c only">; +def warn_attribute_type_not_supported : Warning< + "'%0' attribute argument not supported: %1">; +def warn_attribute_unknown_visibility : Warning<"unknown visibility '%1'">; +def err_unknown_machine_mode : Error<"unknown machine mode %0">; +def err_unsupported_machine_mode : Error<"unsupported machine mode %0">; +def err_mode_not_primitive : Error< + "mode attribute only supported for integer and floating-point types">; +def err_mode_wrong_type : Error< + "type of machine mode does not match type of base type">; +def err_attr_wrong_decl : Error< + "'%0' attribute invalid on this declaration, requires typedef or value">; +def warn_attribute_nonnull_no_pointers : Warning< + "'nonnull' attribute applied to function with no pointer arguments">; +def warn_transparent_union_nonpointer : Warning< + "'transparent_union' attribute support incomplete; only supported for pointer unions">; +def warn_attribute_sentinel_not_variadic : Warning< + "'sentinel' attribute only supported for variadic functions">; +def err_attribute_sentinel_less_than_zero : Error< + "'sentinel' parameter 1 less than zero">; +def err_attribute_sentinel_not_zero_or_one : Error< + "'sentinel' parameter 2 not 0 or 1">; +def err_attribute_cleanup_arg_not_found : Error< + "'cleanup' argument %0 not found">; +def err_attribute_cleanup_arg_not_function : Error< + "'cleanup' argument %0 is not a function">; +def err_attribute_cleanup_func_must_take_one_arg : Error< + "'cleanup' function %0 must take 1 parameter">; +def err_attribute_cleanup_func_arg_incompatible_type : Error< + "'cleanup' function %0 parameter has type %1 which is incompatible with type %2">; + +def err_attribute_iboutlet : Error< + "'iboutlet' attribute can only be applied to instance variables or properties">; +def err_attribute_overloadable_not_function : Error< + "'overloadable' attribute can only be applied to a function">; +def err_attribute_overloadable_missing : Error< + "%select{overloaded function|redeclaration of}0 %1 must have the 'overloadable' attribute">; +def note_attribute_overloadable_prev_overload : Note< + "previous overload of function is here">; +def err_attribute_overloadable_no_prototype : Error< + "'overloadable' function %0 must have a prototype">; + +def err_param_with_void_type : Error<"argument may not have 'void' type">; +def err_void_only_param : Error< + "'void' must be the first and only parameter if specified">; +def err_void_param_qualified : Error< + "'void' as parameter must not have type qualifiers">; +def err_ident_list_in_fn_declaration : Error< + "a parameter list without types is only allowed in a function definition">; +def ext_param_not_declared : Extension< + "parameter %0 was not declared, defaulting to type 'int'">; +def ext_param_typedef_of_void : Extension< + "empty parameter list defined with a typedef of 'void' not allowed in C++">; +def err_param_default_argument : Error<"C does not support default arguments">; +def err_param_default_argument_redefinition : Error< + "redefinition of default argument">; +def err_param_default_argument_missing : Error< + "missing default argument on parameter">; +def err_param_default_argument_missing_name : Error< + "missing default argument on parameter %0">; +def err_param_default_argument_references_param : Error< + "default argument references parameter %0">; +def err_param_default_argument_references_local : Error< + "default argument references local variable %0 of enclosing function">; +def err_param_default_argument_references_this : Error< + "default argument references 'this'">; +def err_param_default_argument_nonfunc : Error< + "default arguments can only be specified for parameters in a function declaration">; + +def err_ovl_diff_return_type : Error< + "functions that differ only in their return type cannot be overloaded">; +def err_ovl_static_nonstatic_member : Error< + "static and non-static member functions with the same parameter types cannot be overloaded">; +def err_ovl_no_viable_function_in_call : Error< + "no matching function for call to %0">; +def err_ovl_no_viable_member_function_in_call : Error< + "no matching member function for call to %0">; +def err_ovl_ambiguous_call : Error<"call to %0 is ambiguous">; +def err_ovl_deleted_call : Error< + "call to %select{unavailable|deleted}0 function %1">; +def err_ovl_ambiguous_member_call : Error< + "call to member function %0 is ambiguous">; +def err_ovl_deleted_member_call : Error< + "call to %select{unavailable|deleted}0 member function %1">; +def err_ovl_candidate : Note<"candidate function">; +def err_ovl_candidate_deleted : Note< + "candidate function has been explicitly %select{made unavailable|deleted}0">; +def err_ovl_builtin_candidate : Note<"built-in candidate function %0">; +def err_ovl_no_viable_function_in_init : Error< + "no matching constructor for initialization of %0">; +def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">; +def err_ovl_deleted_init : Error< + "call to %select{unavailable|deleted}0 constructor of %1">; +def err_ovl_ambiguous_oper : Error< + "use of overloaded operator '%0' is ambiguous">; +def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">; +def err_ovl_deleted_oper : Error< + "overload resolution selected %select{unavailable|deleted}0 operator '%1'">; + +def err_ovl_no_viable_object_call : Error< + "no matching function for call to object of type %0">; +def err_ovl_ambiguous_object_call : Error< + "call to object of type %0 is ambiguous">; +def err_ovl_deleted_object_call : Error< + "call to %select{unavailable|deleted}0 function call operator in type %1">; +def err_ovl_surrogate_cand : Note<"conversion candidate of type %0">; +def err_member_call_without_object : Error< + "call to non-static member function without an object argument">; + +}