Home | History | Annotate | Download | only in Basic
      1 //==--- DiagnosticParseKinds.td - libparse diagnostics --------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 //===----------------------------------------------------------------------===//
     11 // Parser Diagnostics
     12 //===----------------------------------------------------------------------===//
     13 
     14 let Component = "Parse" in {
     15 
     16 def w_asm_qualifier_ignored : Warning<"ignored %0 qualifier on asm">,
     17                               CatInlineAsm;
     18 def warn_file_asm_volatile : Warning<
     19   "meaningless 'volatile' on asm outside function">, CatInlineAsm;
     20 
     21 let CategoryName = "Inline Assembly Issue" in {
     22 def err_asm_empty : Error<"__asm used with no assembly instructions">;
     23 def err_inline_ms_asm_parsing : Error<"%0">;
     24 def err_msasm_unsupported_arch : Error<
     25   "Unsupported architecture '%0' for MS-style inline assembly">;
     26 }
     27 
     28 let CategoryName = "Parse Issue" in {
     29 
     30 def ext_empty_translation_unit : Extension<
     31   "ISO C requires a translation unit to contain at least one declaration">,
     32   InGroup<DiagGroup<"empty-translation-unit">>;
     33 def warn_cxx98_compat_top_level_semi : Warning<
     34   "extra ';' outside of a function is incompatible with C++98">,
     35   InGroup<CXX98CompatPedantic>, DefaultIgnore;
     36 def ext_extra_semi : Extension<
     37   "extra ';' %select{"
     38   "outside of a function|"
     39   "inside a %1|"
     40   "inside instance variable list|"
     41   "after member function definition}0">,
     42   InGroup<ExtraSemi>;
     43 def ext_extra_semi_cxx11 : Extension<
     44   "extra ';' outside of a function is a C++11 extension">,
     45   InGroup<CXX11ExtraSemi>;
     46 def warn_extra_semi_after_mem_fn_def : Warning<
     47   "extra ';' after member function definition">,
     48   InGroup<ExtraSemi>, DefaultIgnore;
     49 
     50 def ext_duplicate_declspec : ExtWarn<"duplicate '%0' declaration specifier">,
     51   InGroup<DuplicateDeclSpecifier>;
     52 def warn_duplicate_declspec : Warning<"duplicate '%0' declaration specifier">,
     53   InGroup<DuplicateDeclSpecifier>;
     54 def ext_plain_complex : ExtWarn<
     55   "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
     56 def ext_integer_complex : Extension<
     57   "complex integer types are a GNU extension">, InGroup<GNU>;
     58 def ext_thread_before : Extension<"'__thread' before '%0'">;
     59 
     60 def error_empty_enum : Error<"use of empty enum">;
     61 def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
     62 def err_invalid_short_spec : Error<"'short %0' is invalid">;
     63 def err_invalid_long_spec : Error<"'long %0' is invalid">;
     64 def err_invalid_longlong_spec : Error<"'long long %0' is invalid">;
     65 def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
     66 def err_friend_storage_spec : Error<"'%0' is invalid in friend declarations">;
     67 
     68 def ext_ident_list_in_param : Extension<
     69   "type-less parameter names in function declaration">;
     70 def ext_c99_variable_decl_in_for_loop : Extension<
     71   "variable declaration in for loop is a C99-specific feature">, InGroup<C99>;
     72 def ext_c99_compound_literal : Extension<
     73   "compound literals are a C99-specific feature">, InGroup<C99>;
     74 def ext_c99_flexible_array_member : Extension<
     75   "Flexible array members are a C99-specific feature">, InGroup<C99>;
     76 def ext_enumerator_list_comma_c : Extension<
     77   "commas at the end of enumerator lists are a C99-specific "
     78   "feature">, InGroup<C99>;
     79 def ext_enumerator_list_comma_cxx : Extension<
     80   "commas at the end of enumerator lists are a C++11 extension">,
     81   InGroup<CXX11>;
     82 def warn_cxx98_compat_enumerator_list_comma : Warning<
     83   "commas at the end of enumerator lists are incompatible with C++98">,
     84   InGroup<CXX98CompatPedantic>, DefaultIgnore;
     85 def err_enumerator_list_missing_comma : Error<
     86   "missing ',' between enumerators">;
     87 def err_enumerator_unnamed_no_def : Error<
     88   "unnamed enumeration must be a definition">;
     89 def ext_cxx11_enum_fixed_underlying_type : Extension<
     90   "enumeration types with a fixed underlying type are a C++11 extension">, 
     91   InGroup<CXX11>;
     92 def ext_c_enum_fixed_underlying_type : Extension<
     93   "enumeration types with a fixed underlying type are a Microsoft extension">,
     94   InGroup<Microsoft>;
     95 def warn_cxx98_compat_enum_fixed_underlying_type : Warning<
     96   "enumeration types with a fixed underlying type are incompatible with C++98">,
     97   InGroup<CXX98Compat>, DefaultIgnore;
     98 def warn_cxx98_compat_alignof : Warning<
     99   "alignof expressions are incompatible with C++98">,
    100   InGroup<CXX98Compat>, DefaultIgnore;
    101 def ext_alignof_expr : ExtWarn<
    102   "%0 applied to an expression is a GNU extension">, InGroup<GNU>;
    103 
    104 def warn_microsoft_dependent_exists : Warning<
    105   "dependent %select{__if_not_exists|__if_exists}0 declarations are ignored">, 
    106   InGroup<DiagGroup<"microsoft-exists">>;
    107 
    108 def ext_c11_generic_selection : Extension<
    109   "generic selections are a C11-specific feature">, InGroup<C11>;
    110 def err_duplicate_default_assoc : Error<
    111   "duplicate default generic association">;
    112 def note_previous_default_assoc : Note<
    113   "previous default generic association is here">;
    114 
    115 def ext_c11_alignment : Extension<
    116   "%0 is a C11-specific feature">, InGroup<C11>;
    117 
    118 def ext_c11_noreturn : Extension<
    119   "_Noreturn functions are a C11-specific feature">, InGroup<C11>;
    120 
    121 def ext_gnu_indirect_goto : Extension<
    122   "use of GNU indirect-goto extension">, InGroup<GNU>;
    123 def ext_gnu_address_of_label : Extension<
    124   "use of GNU address-of-label extension">, InGroup<GNU>;
    125 def ext_gnu_local_label : Extension<
    126   "use of GNU locally declared label extension">, InGroup<GNU>;
    127 def ext_gnu_statement_expr : Extension<
    128   "use of GNU statement expression extension">, InGroup<GNU>;
    129 def ext_gnu_conditional_expr : Extension<
    130   "use of GNU ?: expression extension, eliding middle term">, InGroup<GNU>;
    131 def ext_gnu_empty_initializer : Extension<
    132   "use of GNU empty initializer extension">, InGroup<GNU>;
    133 def ext_gnu_array_range : Extension<"use of GNU array range extension">, 
    134   InGroup<GNUDesignator>;
    135 def ext_gnu_missing_equal_designator : ExtWarn<
    136   "use of GNU 'missing =' extension in designator">, 
    137   InGroup<GNUDesignator>;
    138 def err_expected_equal_designator : Error<"expected '=' or another designator">;
    139 def ext_gnu_old_style_field_designator : ExtWarn<
    140   "use of GNU old-style field designator extension">, 
    141   InGroup<GNUDesignator>;
    142 def ext_gnu_case_range : Extension<"use of GNU case range extension">,
    143   InGroup<GNU>;
    144 
    145 // Generic errors.
    146 def err_expected_expression : Error<"expected expression">;
    147 def err_expected_type : Error<"expected a type">;
    148 def err_expected_external_declaration : Error<"expected external declaration">;
    149 def err_extraneous_closing_brace : Error<"extraneous closing brace ('}')">;
    150 def err_expected_ident : Error<"expected identifier">;
    151 def err_expected_ident_lparen : Error<"expected identifier or '('">;
    152 def err_expected_ident_lbrace : Error<"expected identifier or '{'">;
    153 def err_expected_lbrace : Error<"expected '{'">;
    154 def err_expected_lparen : Error<"expected '('">;
    155 def err_expected_lparen_or_lbrace : Error<"expected '(' or '{'">;
    156 def err_expected_rparen : Error<"expected ')'">;
    157 def err_expected_lsquare : Error<"expected '['">;
    158 def err_expected_rsquare : Error<"expected ']'">;
    159 def err_expected_rbrace : Error<"expected '}'">;
    160 def err_expected_greater : Error<"expected '>'">;
    161 def err_expected_ggg : Error<"expected '>>>'">;
    162 def err_expected_semi_declaration : Error<
    163   "expected ';' at end of declaration">;
    164 def err_expected_semi_decl_list : Error<
    165   "expected ';' at end of declaration list">;
    166 def ext_expected_semi_decl_list : ExtWarn<
    167   "expected ';' at end of declaration list">;
    168 def err_expected_member_name_or_semi : Error<
    169   "expected member name or ';' after declaration specifiers">;
    170 def err_function_declared_typedef : Error<
    171   "function definition declared 'typedef'">;
    172 def err_iboutletcollection_builtintype : Error<
    173   "type argument of iboutletcollection attribute cannot be a builtin type">;
    174 def err_iboutletcollection_with_protocol : Error<
    175   "invalid argument of iboutletcollection attribute">;
    176 def err_at_defs_cxx : Error<"@defs is not supported in Objective-C++">;
    177 def err_at_in_class : Error<"unexpected '@' in member specification">;
    178 
    179 def err_expected_fn_body : Error<
    180   "expected function body after function declarator">;
    181 def warn_attribute_on_function_definition : Warning<
    182   "GCC does not allow %0 attribute in this position on a function definition">, 
    183   InGroup<GccCompat>;
    184 def warn_attribute_no_decl : Warning<
    185   "attribute %0 ignored, because it is not attached to a declaration">, 
    186   InGroup<IgnoredAttributes>;
    187 def err_expected_method_body : Error<"expected method body">;
    188 def err_invalid_token_after_toplevel_declarator : Error<
    189   "expected ';' after top level declarator">;
    190 def err_invalid_token_after_declarator_suggest_equal : Error<
    191   "invalid '%0' at end of declaration; did you mean '='?">;
    192 def err_expected_statement : Error<"expected statement">;
    193 def err_expected_lparen_after : Error<"expected '(' after '%0'">;
    194 def err_expected_lparen_after_id : Error<"expected '(' after %0">;
    195 def err_expected_less_after : Error<"expected '<' after '%0'">;
    196 def err_expected_equal_after : Error<"expected '=' after %0">;
    197 def err_expected_comma : Error<"expected ','">;
    198 def err_expected_lbrace_in_compound_literal : Error<
    199   "expected '{' in compound literal">;
    200 def err_expected_while : Error<"expected 'while' in do/while loop">;
    201 
    202 def err_expected_semi_after : Error<"expected ';' after %0">;
    203 def err_expected_semi_after_stmt : Error<"expected ';' after %0 statement">;
    204 def err_expected_semi_after_expr : Error<"expected ';' after expression">;
    205 def err_extraneous_token_before_semi : Error<"extraneous '%0' before ';'">;
    206 
    207 def err_expected_semi_after_method_proto : Error<
    208   "expected ';' after method prototype">;
    209 def err_expected_semi_after_namespace_name : Error<
    210   "expected ';' after namespace name">;
    211 def err_unexpected_namespace_attributes_alias : Error<
    212   "attributes can not be specified on namespace alias">;
    213 def err_inline_namespace_alias : Error<"namespace alias cannot be inline">;
    214 def err_namespace_nonnamespace_scope : Error<
    215   "namespaces can only be defined in global or namespace scope">;
    216 def err_nested_namespaces_with_double_colon : Error<
    217   "nested namespace definition must define each namespace separately">;
    218 def err_expected_semi_after_attribute_list : Error<
    219   "expected ';' after attribute list">;
    220 def err_expected_semi_after_static_assert : Error<
    221   "expected ';' after static_assert">;
    222 def err_expected_semi_for : Error<"expected ';' in 'for' statement specifier">;
    223 def err_expected_colon_after : Error<"expected ':' after %0">;
    224 def warn_missing_selector_name : Warning<
    225   "%0 used as the name of the previous parameter rather than as part "
    226   "of the selector">,
    227   InGroup<DiagGroup<"missing-selector-name">>;
    228 def note_missing_selector_name : Note<
    229   "introduce a parameter name to make %0 part of the selector">;
    230 def note_force_empty_selector_name : Note<
    231   "or insert whitespace before ':' to use %0 as parameter name "
    232   "and have an empty entry in the selector">;
    233 def err_label_end_of_compound_statement : Error<
    234   "label at end of compound statement: expected statement">;
    235 def err_address_of_label_outside_fn : Error<
    236   "use of address-of-label extension outside of a function body">;
    237 def err_asm_operand_wide_string_literal : Error<
    238   "cannot use %select{unicode|wide}0 string literal in 'asm'">;
    239 def err_expected_selector_for_method : Error<
    240   "expected selector for Objective-C method">;
    241 def err_expected_property_name : Error<"expected property name">;
    242 
    243 def err_unexpected_at : Error<"unexpected '@' in program">;
    244 
    245 def err_invalid_reference_qualifier_application : Error<
    246   "'%0' qualifier may not be applied to a reference">;
    247 def err_illegal_decl_reference_to_reference : Error<
    248   "%0 declared as a reference to a reference">;
    249 def ext_rvalue_reference : ExtWarn<
    250   "rvalue references are a C++11 extension">, InGroup<CXX11>;
    251 def warn_cxx98_compat_rvalue_reference : Warning<
    252   "rvalue references are incompatible with C++98">,
    253   InGroup<CXX98Compat>, DefaultIgnore;
    254 def ext_ref_qualifier : ExtWarn<
    255   "reference qualifiers on functions are a C++11 extension">, InGroup<CXX11>;
    256 def warn_cxx98_compat_ref_qualifier : Warning<
    257   "reference qualifiers on functions are incompatible with C++98">,
    258   InGroup<CXX98Compat>, DefaultIgnore;
    259 def ext_inline_namespace : ExtWarn<
    260   "inline namespaces are a C++11 feature">, InGroup<CXX11>;
    261 def warn_cxx98_compat_inline_namespace : Warning<
    262   "inline namespaces are incompatible with C++98">,
    263   InGroup<CXX98Compat>, DefaultIgnore;
    264 def ext_generalized_initializer_lists : ExtWarn<
    265   "generalized initializer lists are a C++11 extension">,
    266   InGroup<CXX11>;
    267 def warn_cxx98_compat_generalized_initializer_lists : Warning<
    268   "generalized initializer lists are incompatible with C++98">,
    269   InGroup<CXX98Compat>, DefaultIgnore;
    270 def err_init_list_bin_op : Error<"initializer list cannot be used on the "
    271   "%select{left|right}0 hand side of operator '%1'">;
    272 def warn_cxx98_compat_trailing_return_type : Warning<
    273   "trailing return types are incompatible with C++98">,
    274   InGroup<CXX98Compat>, DefaultIgnore;
    275 def ext_auto_type_specifier : ExtWarn<
    276   "'auto' type specifier is a C++11 extension">, InGroup<CXX11>;
    277 def warn_auto_storage_class : Warning<
    278   "'auto' storage class specifier is redundant and incompatible with C++11">,
    279   InGroup<CXX11Compat>, DefaultIgnore;
    280 def ext_auto_storage_class : ExtWarn<
    281   "'auto' storage class specifier is not permitted in C++11, and will not "
    282   "be supported in future releases">, InGroup<DiagGroup<"auto-storage-class">>;
    283 def ext_decltype_auto_type_specifier : ExtWarn<
    284   "'decltype(auto)' type specifier is a C++1y extension">, InGroup<CXX1y>;
    285 def warn_cxx11_compat_decltype_auto_type_specifier : Warning<
    286   "'decltype(auto)' type specifier is incompatible with C++ standards before "
    287   "C++1y">, InGroup<CXXPre1yCompat>, DefaultIgnore;
    288 def ext_for_range : ExtWarn<
    289   "range-based for loop is a C++11 extension">, InGroup<CXX11>;
    290 def warn_cxx98_compat_for_range : Warning<
    291   "range-based for loop is incompatible with C++98">,
    292   InGroup<CXX98Compat>, DefaultIgnore;
    293 def err_for_range_expected_decl : Error<
    294   "for range declaration must declare a variable">;
    295 def err_argument_required_after_attribute : Error<
    296   "argument required after attribute">;
    297 def err_missing_param : Error<"expected parameter declarator">;
    298 def err_missing_comma_before_ellipsis : Error<
    299   "C requires a comma prior to the ellipsis in a variadic function type">;
    300 def err_unexpected_typedef_ident : Error<
    301   "unexpected type name %0: expected identifier">;
    302 def warn_cxx98_compat_decltype : Warning<
    303   "'decltype' type specifier is incompatible with C++98">,
    304   InGroup<CXX98Compat>, DefaultIgnore;
    305 def err_unexpected_scope_on_base_decltype : Error<
    306   "unexpected namespace scope prior to decltype">;
    307 def err_expected_class_name : Error<"expected class name">;
    308 def err_expected_class_name_not_template : 
    309   Error<"'typename' is redundant; base classes are implicitly types">;
    310 def err_unspecified_vla_size_with_static : Error<
    311   "'static' may not be used with an unspecified variable length array size">;
    312 def warn_deprecated_register : Warning<
    313   "'register' storage class specifier is deprecated">,
    314   InGroup<DeprecatedRegister>;
    315 
    316 def err_expected_case_before_expression: Error<
    317   "expected 'case' keyword before expression">;
    318 
    319 // Declarations.
    320 def err_typename_requires_specqual : Error<
    321   "type name requires a specifier or qualifier">;
    322 def err_typename_invalid_storageclass : Error<
    323   "type name does not allow storage class to be specified">;
    324 def err_typename_invalid_functionspec : Error<
    325   "type name does not allow function specifier to be specified">;
    326 def err_typename_invalid_constexpr : Error<
    327   "type name does not allow constexpr specifier to be specified">;
    328 def err_typename_identifiers_only : Error<
    329   "typename is allowed for identifiers only">;
    330 
    331 def err_invalid_decl_spec_combination : Error<
    332   "cannot combine with previous '%0' declaration specifier">;
    333 def err_invalid_vector_decl_spec_combination : Error<
    334   "cannot combine with previous '%0' declaration specifier. "
    335   "'__vector' must be first">;
    336 def err_invalid_pixel_decl_spec_combination : Error<
    337   "'__pixel' must be preceded by '__vector'.  "
    338   "'%0' declaration specifier not allowed here">;
    339 def err_invalid_vector_decl_spec : Error<
    340   "cannot use '%0' with '__vector'">;
    341 def err_invalid_vector_bool_decl_spec : Error<
    342   "cannot use '%0' with '__vector bool'">;
    343 def warn_vector_long_decl_spec_combination : Warning<
    344   "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
    345 def err_friend_invalid_in_context : Error<
    346   "'friend' used outside of class">;
    347 def err_unknown_typename : Error<
    348   "unknown type name %0">;
    349 def err_use_of_tag_name_without_tag : Error<
    350   "must use '%1' tag to refer to type %0%select{| in this scope}2">;
    351 def err_templated_using_directive : Error<
    352   "cannot template a using directive">;
    353 def err_templated_using_declaration : Error<
    354   "cannot template a using declaration">;
    355 def err_unexected_colon_in_nested_name_spec : Error<
    356   "unexpected ':' in nested name specifier; did you mean '::'?">;
    357 def err_bool_redeclaration : Error<
    358   "redeclaration of C++ built-in type 'bool'">;
    359 def ext_c11_static_assert : Extension<
    360   "_Static_assert is a C11-specific feature">, InGroup<C11>;
    361 def warn_cxx98_compat_static_assert : Warning<
    362   "static_assert declarations are incompatible with C++98">,
    363   InGroup<CXX98Compat>, DefaultIgnore;
    364 def err_paren_after_colon_colon : Error<
    365   "unexpected parenthesis after '::'">;
    366 def err_function_definition_not_allowed : Error<
    367   "function definition is not allowed here">;
    368 
    369 /// Objective-C parser diagnostics
    370 def err_expected_minus_or_plus : Error<
    371   "method type specifier must start with '-' or '+'">;
    372 def err_objc_no_attributes_on_category : Error<
    373   "attributes may not be specified on a category">;
    374 def err_objc_missing_end : Error<"missing '@end'">;
    375 def note_objc_container_start : Note<
    376   "%select{class|protocol|category|class extension|implementation"
    377   "|category implementation}0 started here">;
    378 def warn_objc_protocol_qualifier_missing_id : Warning<
    379   "protocol has no object type specified; defaults to qualified 'id'">;
    380 def err_objc_unknown_at : Error<"expected an Objective-C directive after '@'">;
    381 def err_illegal_super_cast : Error<
    382   "cannot cast 'super' (it isn't an expression)">;
    383 def err_nsnumber_nonliteral_unary : Error<
    384   "@%0 must be followed by a number to form an NSNumber object">;
    385 def warn_cstyle_param : Warning<
    386   "use of C-style parameters in Objective-C method declarations"
    387   " is deprecated">, InGroup<DeprecatedDeclarations>;
    388 
    389 let CategoryName = "ARC Parse Issue" in {
    390 def err_arc_bridge_retain : Error<
    391   "unknown cast annotation __bridge_retain; did you mean __bridge_retained?">;
    392 // To be default mapped to an error later.
    393 def warn_arc_bridge_cast_nonarc : Warning<
    394   "'%0' casts have no effect when not using ARC">,
    395   InGroup<DiagGroup<"arc-bridge-casts-disallowed-in-nonarc">>;
    396 }
    397   
    398 def err_objc_illegal_visibility_spec : Error<
    399   "illegal visibility specification">;
    400 def err_objc_illegal_interface_qual : Error<"illegal interface qualifier">;
    401 def err_objc_expected_equal_for_getter : Error<
    402   "expected '=' for Objective-C getter">;
    403 def err_objc_expected_equal_for_setter : Error<
    404   "expected '=' for Objective-C setter">;
    405 def err_objc_expected_selector_for_getter_setter : Error<
    406   "expected selector for Objective-C %select{setter|getter}0">;
    407 def err_objc_property_requires_field_name : Error<
    408   "property requires fields to be named">;
    409 def err_objc_property_bitfield : Error<"property name cannot be a bitfield">;
    410 def err_objc_expected_property_attr : Error<"unknown property attribute %0">;
    411 def err_objc_properties_require_objc2 : Error<
    412   "properties are an Objective-C 2 feature">;
    413 def err_objc_unexpected_attr : Error<
    414   "prefix attribute must be followed by an interface or protocol">;
    415 def err_objc_postfix_attribute : Error <
    416   "postfix attributes are not allowed on Objective-C directives">;
    417 def err_objc_postfix_attribute_hint : Error <
    418   "postfix attributes are not allowed on Objective-C directives, place"
    419   " them in front of '%select{@interface|@protocol}0'">;
    420 def err_objc_directive_only_in_protocol : Error<
    421   "directive may only be specified in protocols only">;
    422 def err_missing_catch_finally : Error<
    423   "@try statement without a @catch and @finally clause">;
    424 def err_objc_concat_string : Error<"unexpected token after Objective-C string">;
    425 def err_expected_objc_container : Error<
    426   "'@end' must appear in an Objective-C context">;
    427 def err_unexpected_protocol_qualifier : Error<
    428   "@implementation declaration can not be protocol qualified">;
    429 def err_objc_unexpected_atend : Error<
    430   "'@end' appears where closing brace '}' is expected">;
    431 def error_property_ivar_decl : Error<
    432   "property synthesize requires specification of an ivar">;
    433 def err_synthesized_property_name : Error<
    434   "expected a property name in @synthesize">;
    435 def warn_semicolon_before_method_body : Warning<
    436   "semicolon before method body is ignored">,
    437   InGroup<DiagGroup<"semicolon-before-method-body">>, DefaultIgnore;
    438 def note_extra_comma_message_arg : Note<
    439   "comma separating Objective-C messaging arguments">;
    440 
    441 def err_expected_field_designator : Error<
    442   "expected a field designator, such as '.field = 4'">;
    443 
    444 def err_declaration_does_not_declare_param : Error<
    445   "declaration does not declare a parameter">;
    446 def err_no_matching_param : Error<"parameter named %0 is missing">;
    447 
    448 /// C++ parser diagnostics
    449 def err_invalid_operator_on_type : Error<
    450   "cannot use %select{dot|arrow}0 operator on a type">;
    451 def err_expected_unqualified_id : Error<
    452   "expected %select{identifier|unqualified-id}0">;
    453 def err_unexpected_unqualified_id : Error<"type-id cannot have a name">;
    454 def err_func_def_no_params : Error<
    455   "function definition does not declare parameters">;
    456 def err_expected_lparen_after_type : Error<
    457   "expected '(' for function-style cast or type construction">;
    458 def err_expected_init_in_condition : Error<
    459   "variable declaration in condition must have an initializer">;
    460 def err_expected_init_in_condition_lparen : Error<
    461   "variable declaration in condition cannot have a parenthesized initializer">;
    462 def err_extraneous_rparen_in_condition : Error<
    463   "extraneous ')' after condition, expected a statement">;
    464 def warn_dangling_else : Warning<
    465   "add explicit braces to avoid dangling else">,
    466   InGroup<DanglingElse>;
    467 def err_expected_member_or_base_name : Error<
    468   "expected class member or base class name">;
    469 def err_expected_lbrace_after_base_specifiers : Error<
    470   "expected '{' after base class list">;
    471 def ext_ellipsis_exception_spec : Extension<
    472   "exception specification of '...' is a Microsoft extension">,
    473   InGroup<Microsoft>;
    474 def err_dynamic_and_noexcept_specification : Error<
    475   "cannot have both throw() and noexcept() clause on the same function">;
    476 def warn_cxx98_compat_noexcept_decl : Warning<
    477   "noexcept specifications are incompatible with C++98">,
    478   InGroup<CXX98Compat>, DefaultIgnore;
    479 def err_expected_catch : Error<"expected catch">;
    480 def err_expected_lbrace_or_comma : Error<"expected '{' or ','">;
    481 def err_expected_rbrace_or_comma : Error<"expected '}' or ','">;
    482 def err_expected_rsquare_or_comma : Error<"expected ']' or ','">;
    483 def err_using_namespace_in_class : Error<
    484   "'using namespace' is not allowed in classes">;
    485 def err_destructor_tilde_identifier : Error<
    486   "expected a class name after '~' to name a destructor">;
    487 def err_destructor_template_id : Error<
    488   "destructor name %0 does not refer to a template">;
    489 def err_default_arg_unparsed : Error<
    490   "unexpected end of default argument expression">;
    491 def err_bracket_depth_exceeded : Error<
    492   "bracket nesting level exceeded maximum of %0">, DefaultFatal;
    493 def note_bracket_depth : Note<
    494   "use -fbracket-depth=N to increase maximum nesting level">;
    495 def err_misplaced_ellipsis_in_declaration : Error<
    496   "'...' must %select{immediately precede declared identifier|"
    497   "be innermost component of anonymous pack declaration}0">;
    498 def ext_abstract_pack_declarator_parens : ExtWarn<
    499   "ISO C++11 requires a parenthesized pack declaration to have a name">,
    500   InGroup<DiagGroup<"anonymous-pack-parens">>;
    501 def err_function_is_not_record : Error<
    502   "unexpected '%select{.|->}0' in function call; perhaps remove the "
    503   "'%select{.|->}0'?">;
    504 
    505 // C++ derived classes
    506 def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">;
    507 
    508 // C++ operator overloading
    509 def err_literal_operator_string_prefix : Error<
    510   "string literal after 'operator' cannot have an encoding prefix">;
    511 def err_literal_operator_string_not_empty : Error<
    512   "string literal after 'operator' must be '\"\"'">;
    513 def warn_cxx98_compat_literal_operator : Warning<
    514   "literal operators are incompatible with C++98">,
    515   InGroup<CXX98Compat>, DefaultIgnore;
    516 
    517 // Classes.
    518 def err_anon_type_definition : Error<
    519   "declaration of anonymous %0 must be a definition">;
    520 def err_default_delete_in_multiple_declaration : Error<
    521   "'= %select{default|delete}0' is a function definition and must occur in a "
    522   "standalone declaration">;
    523 
    524 def warn_cxx98_compat_noexcept_expr : Warning<
    525   "noexcept expressions are incompatible with C++98">,
    526   InGroup<CXX98Compat>, DefaultIgnore;
    527 def warn_cxx98_compat_nullptr : Warning<
    528   "'nullptr' is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
    529 
    530 def warn_cxx98_compat_alignas : Warning<"'alignas' is incompatible with C++98">,
    531   InGroup<CXX98Compat>, DefaultIgnore;
    532 def warn_cxx98_compat_attribute : Warning<
    533   "attributes are incompatible with C++98">,
    534   InGroup<CXX98Compat>, DefaultIgnore;
    535 def err_cxx11_attribute_forbids_arguments : Error<
    536   "attribute '%0' cannot have an argument list">;
    537 def err_cxx11_attribute_forbids_ellipsis : Error<
    538   "attribute '%0' cannot be used as an attribute pack">;
    539 def err_cxx11_attribute_repeated : Error<
    540   "attribute %0 cannot appear multiple times in an attribute specifier">;
    541 def err_attributes_not_allowed : Error<"an attribute list cannot appear here">;
    542 def err_l_square_l_square_not_attribute : Error<
    543   "C++11 only allows consecutive left square brackets when "
    544   "introducing an attribute">;
    545 def err_ms_declspec_type : Error<
    546   "__declspec attributes must be an identifier or string literal">;
    547 def warn_ms_declspec_unknown : Warning<
    548   "unknown __declspec attribute %0 ignored">, InGroup<UnknownAttributes>;
    549 def err_ms_property_no_getter_or_putter : Error<
    550   "property does not specify a getter or a putter">;
    551 def err_ms_property_unknown_accessor : Error<
    552   "expected 'get' or 'put' in property declaration">;
    553 def err_ms_property_has_set_accessor : Error<
    554   "putter for property must be specified as 'put', not 'set'">;
    555 def err_ms_property_missing_accessor_kind : Error<
    556   "missing 'get=' or 'put='">;
    557 def err_ms_property_expected_equal : Error<
    558   "expected '=' after '%0'">;
    559 def err_ms_property_duplicate_accessor : Error<
    560   "property declaration specifies '%0' accessor twice">;
    561 def err_ms_property_expected_accessor_name : Error<
    562   "expected name of accessor method">;
    563 def err_ms_property_expected_comma_or_rparen : Error<
    564   "expected ',' or ')' at end of property accessor list">;
    565 
    566 /// C++ Templates
    567 def err_expected_template : Error<"expected template">;
    568 def err_unknown_template_name : Error<
    569   "unknown template name %0">;
    570 def err_expected_comma_greater : Error<
    571   "expected ',' or '>' in template-parameter-list">;
    572 def err_class_on_template_template_param : Error<
    573   "template template parameter requires 'class' after the parameter list">;
    574 def err_template_spec_syntax_non_template : Error<
    575   "identifier followed by '<' indicates a class template specialization but "
    576   "%0 %select{does not refer to a template|refers to a function "
    577   "template|<unused>|refers to a template template parameter}1">;
    578 def err_id_after_template_in_nested_name_spec : Error<
    579   "expected template name after 'template' keyword in nested name specifier">;
    580 def err_two_right_angle_brackets_need_space : Error<
    581   "a space is required between consecutive right angle brackets (use '> >')">;
    582 def err_right_angle_bracket_equal_needs_space : Error<
    583   "a space is required between a right angle bracket and an equals sign "
    584   "(use '> =')">;
    585 def warn_cxx11_right_shift_in_template_arg : Warning<
    586   "use of right-shift operator ('>>') in template argument will require "
    587   "parentheses in C++11">, InGroup<CXX11Compat>;
    588 def warn_cxx98_compat_two_right_angle_brackets : Warning<
    589   "consecutive right angle brackets are incompatible with C++98 (use '> >')">,
    590   InGroup<CXX98Compat>, DefaultIgnore;
    591 def err_multiple_template_declarators : Error<
    592     "%select{|a template declaration|an explicit template specialization|"
    593     "an explicit template instantiation}0 can "
    594     "only %select{|declare|declare|instantiate}0 a single entity">;
    595 def err_explicit_instantiation_with_definition : Error<
    596     "explicit template instantiation cannot have a definition; if this "
    597     "definition is meant to be an explicit specialization, add '<>' after the "
    598     "'template' keyword">;
    599 def err_template_defn_explicit_instantiation : Error<
    600   "%select{function|class|variable}0 cannot be defined in an explicit instantiation; if this "
    601   "declaration is meant to be a %select{function|class|variable}0 definition, remove the 'template' keyword">;
    602 def err_friend_explicit_instantiation : Error<
    603   "friend cannot be declared in an explicit instantiation; if this "
    604   "declaration is meant to be a friend declaration, remove the 'template' keyword">;
    605 def err_explicit_instantiation_enum : Error<
    606     "enumerations cannot be explicitly instantiated">;
    607 def err_expected_template_parameter : Error<"expected template parameter">;
    608 
    609 def err_missing_dependent_template_keyword : Error<
    610   "use 'template' keyword to treat '%0' as a dependent template name">;
    611 def warn_missing_dependent_template_keyword : ExtWarn<
    612   "use 'template' keyword to treat '%0' as a dependent template name">;
    613 
    614 def ext_extern_template : Extension<
    615   "extern templates are a C++11 extension">, InGroup<CXX11>;
    616 def warn_cxx98_compat_extern_template : Warning<
    617   "extern templates are incompatible with C++98">,
    618   InGroup<CXX98CompatPedantic>, DefaultIgnore;
    619 def warn_static_inline_explicit_inst_ignored : Warning<
    620   "ignoring '%select{static|inline}0' keyword on explicit template "
    621   "instantiation">;
    622   
    623 // Constructor template diagnostics.
    624 def err_out_of_line_constructor_template_id : Error<
    625   "out-of-line constructor for %0 cannot have template arguments">;
    626 def err_out_of_line_template_id_names_constructor : Error<
    627   "qualified reference to %0 is a constructor name rather than a "
    628   "template name wherever a constructor can be declared">;
    629 def err_out_of_line_type_names_constructor : Error<
    630   "qualified reference to %0 is a constructor name rather than a "
    631   "type wherever a constructor can be declared">;
    632 
    633 def err_expected_qualified_after_typename : Error<
    634   "expected a qualified name after 'typename'">;
    635 def warn_expected_qualified_after_typename : ExtWarn<
    636   "expected a qualified name after 'typename'">;
    637 def err_expected_semi_after_tagdecl : Error<
    638   "expected ';' after %0">;
    639 
    640 def err_typename_refers_to_non_type_template : Error<
    641   "typename specifier refers to a non-template">;
    642 def err_expected_type_name_after_typename : Error<
    643   "expected an identifier or template-id after '::'">;
    644 def err_explicit_spec_non_template : Error<
    645   "explicit %select{specialization|instantiation}0 of non-template "
    646   "%select{class|struct|union|interface}1 %2">;
    647   
    648 def err_default_template_template_parameter_not_template : Error<
    649   "default template argument for a template template parameter must be a class "
    650   "template">;
    651   
    652 def err_ctor_init_missing_comma : Error<
    653   "missing ',' between base or member initializers">;
    654 
    655 // C++ declarations
    656 def err_friend_decl_defines_type : Error<
    657   "cannot define a type in a friend declaration">;
    658 def err_missing_whitespace_digraph : Error<
    659   "found '<::' after a "
    660   "%select{template name|const_cast|dynamic_cast|reinterpret_cast|static_cast}0"
    661   " which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?">;
    662 
    663 def ext_deleted_function : ExtWarn<
    664   "deleted function definitions are a C++11 extension">, InGroup<CXX11>;
    665 def warn_cxx98_compat_deleted_function : Warning<
    666   "deleted function definitions are incompatible with C++98">,
    667   InGroup<CXX98Compat>, DefaultIgnore;
    668 def ext_defaulted_function : ExtWarn<
    669   "defaulted function definitions are a C++11 extension">, InGroup<CXX11>;
    670 def warn_cxx98_compat_defaulted_function : Warning<
    671   "defaulted function definitions are incompatible with C++98">,
    672   InGroup<CXX98Compat>, DefaultIgnore;
    673 
    674 // C++11 in-class member initialization
    675 def ext_nonstatic_member_init : ExtWarn<
    676   "in-class initialization of non-static data member is a C++11 extension">,
    677   InGroup<CXX11>;
    678 def warn_cxx98_compat_nonstatic_member_init : Warning<
    679   "in-class initialization of non-static data members is incompatible with C++98">,
    680   InGroup<CXX98Compat>, DefaultIgnore;
    681 def err_bitfield_member_init: Error<
    682   "bitfield member cannot have an in-class initializer">;
    683 def err_incomplete_array_member_init: Error<
    684   "array bound cannot be deduced from an in-class initializer">;
    685 
    686 // C++11 alias-declaration
    687 def ext_alias_declaration : ExtWarn<
    688   "alias declarations are a C++11 extension">, InGroup<CXX11>;
    689 def warn_cxx98_compat_alias_declaration : Warning<
    690   "alias declarations are incompatible with C++98">,
    691   InGroup<CXX98Compat>, DefaultIgnore;
    692 def err_alias_declaration_not_identifier : Error<
    693   "name defined in alias declaration must be an identifier">;
    694 def err_alias_declaration_specialization : Error<
    695   "%select{partial specialization|explicit specialization|explicit instantiation}0 of alias templates is not permitted">;
    696     
    697 // C++11 override control
    698 def ext_override_control_keyword : ExtWarn<
    699   "'%0' keyword is a C++11 extension">, InGroup<CXX11>;
    700 def warn_cxx98_compat_override_control_keyword : Warning<
    701   "'%0' keyword is incompatible with C++98">,
    702   InGroup<CXX98Compat>, DefaultIgnore;
    703 def err_override_control_interface : Error<
    704   "'%0' keyword not permitted with interface types">;
    705 
    706 def err_access_specifier_interface : Error<
    707   "interface types cannot specify '%select{private|protected}0' access">;
    708 
    709 def err_duplicate_virt_specifier : Error<
    710   "class member already marked '%0'">;
    711 
    712 def err_scoped_enum_missing_identifier : Error<
    713   "scoped enumeration requires a name">;
    714 def ext_scoped_enum : ExtWarn<
    715   "scoped enumerations are a C++11 extension">, InGroup<CXX11>;
    716 def warn_cxx98_compat_scoped_enum : Warning<
    717   "scoped enumerations are incompatible with C++98">,
    718   InGroup<CXX98Compat>, DefaultIgnore;
    719 
    720 def err_expected_parameter_pack : Error<
    721   "expected the name of a parameter pack">;
    722 def err_paren_sizeof_parameter_pack : Error<
    723   "missing parentheses around the size of parameter pack %0">;
    724 def err_sizeof_parameter_pack : Error<
    725   "expected parenthesized parameter pack name in 'sizeof...' expression">;
    726 
    727 // C++11 lambda expressions
    728 def err_expected_comma_or_rsquare : Error<
    729   "expected ',' or ']' in lambda capture list">;
    730 def err_this_captured_by_reference : Error<
    731   "'this' cannot be captured by reference">;
    732 def err_expected_capture : Error<
    733   "expected variable name or 'this' in lambda capture list">;
    734 def err_expected_lambda_body : Error<"expected body of lambda expression">;
    735 def warn_cxx98_compat_lambda : Warning<
    736   "lambda expressions are incompatible with C++98">,
    737   InGroup<CXX98Compat>, DefaultIgnore;
    738 def err_lambda_missing_parens : Error<
    739   "lambda requires '()' before %select{'mutable'|return type}0">;
    740 
    741 // Availability attribute
    742 def err_expected_version : Error<
    743   "expected a version of the form 'major[.minor[.subminor]]'">;
    744 def err_zero_version : Error<
    745   "version number must have non-zero major, minor, or sub-minor version">;
    746 def err_availability_expected_platform : Error<
    747   "expected a platform name, e.g., 'macosx'">;
    748 def err_availability_expected_change : Error<
    749   "expected 'introduced', 'deprecated', or 'obsoleted'">;
    750 def err_availability_unknown_change : Error<
    751   "%0 is not an availability stage; use 'introduced', 'deprecated', or "
    752   "'obsoleted'">;
    753 def err_availability_redundant : Error<
    754   "redundant %0 availability change; only the last specified change will "
    755   "be used">;
    756 def warn_availability_and_unavailable : Warning<
    757   "'unavailable' availability overrides all other availability information">,
    758   InGroup<Availability>;
    759 
    760 // Type safety attributes
    761 def err_type_safety_unknown_flag : Error<
    762   "invalid comparison flag %0; use 'layout_compatible' or 'must_be_null'">;
    763 
    764 // Language specific pragmas
    765 // - Generic warnings
    766 def warn_pragma_expected_lparen : Warning<
    767   "missing '(' after '#pragma %0' - ignoring">;
    768 def warn_pragma_expected_rparen : Warning<
    769   "missing ')' after '#pragma %0' - ignoring">;
    770 def warn_pragma_expected_identifier : Warning<
    771   "expected identifier in '#pragma %0' - ignored">;  
    772 def warn_pragma_ms_struct : Warning<
    773   "incorrect use of '#pragma ms_struct on|off' - ignored">;  
    774 def warn_pragma_extra_tokens_at_eol : Warning<
    775   "extra tokens at end of '#pragma %0' - ignored">; 
    776 // - #pragma options
    777 def warn_pragma_options_expected_align : Warning<
    778   "expected 'align' following '#pragma options' - ignored">;
    779 def warn_pragma_align_expected_equal : Warning<
    780   "expected '=' following '#pragma %select{align|options align}0' - ignored">;
    781 def warn_pragma_align_invalid_option : Warning<
    782   "invalid alignment option in '#pragma %select{align|options align}0' - ignored">;
    783 // - #pragma pack
    784 def warn_pragma_pack_invalid_action : Warning<
    785   "unknown action for '#pragma pack' - ignored">;
    786 def warn_pragma_pack_malformed : Warning<
    787   "expected integer or identifier in '#pragma pack' - ignored">;
    788 // - #pragma unused
    789 def warn_pragma_unused_expected_var : Warning<
    790   "expected '#pragma unused' argument to be a variable name">;
    791 def warn_pragma_unused_expected_punc : Warning<
    792   "expected ')' or ',' in '#pragma unused'">;
    793 // - #pragma fp_contract
    794 def err_pragma_fp_contract_scope : Error<
    795   "'#pragma fp_contract' should only appear at file scope or at the start of a "
    796   "compound expression">; 
    797 // - #pragma comment
    798 def err_pragma_comment_malformed : Error<
    799   "pragma comment requires parenthesized identifier and optional string">;
    800 def err_pragma_comment_unknown_kind : Error<"unknown kind of pragma comment">;
    801 // - #pragma detect_mismatch
    802 def err_pragma_detect_mismatch_malformed : Error<
    803   "pragma detect_mismatch is malformed; it requires two comma-separated "
    804   "string literals">;
    805 
    806 // OpenCL Section 6.8.g
    807 def err_not_opencl_storage_class_specifier : Error<
    808   "OpenCL does not support the '%0' storage class specifier">;
    809 
    810 // OpenCL EXTENSION pragma (OpenCL 1.1 [9.1])
    811 def warn_pragma_expected_colon : Warning<
    812   "missing ':' after %0 - ignoring">;
    813 def warn_pragma_expected_enable_disable : Warning<
    814   "expected 'enable' or 'disable' - ignoring">;
    815 def warn_pragma_unknown_extension : Warning<
    816   "unknown OpenCL extension %0 - ignoring">;
    817 
    818 def err_seh_expected_handler : Error<
    819   "expected '__except' or '__finally' block">;
    820 
    821 def err_seh___except_block : Error<
    822   "%0 only allowed in __except block">;
    823 
    824 def err_seh___except_filter : Error<
    825   "%0 only allowed in __except filter expression">;
    826 
    827 def err_seh___finally_block : Error<
    828   "%0 only allowed in __finally block">;
    829 
    830 // OpenMP support.
    831 def warn_pragma_omp_ignored : Warning <
    832   "unexpected '#pragma omp ...' in program">, InGroup<SourceUsesOpenMP>, DefaultIgnore;
    833 def warn_omp_extra_tokens_at_eol : Warning <
    834   "extra tokens at the end of '#pragma omp %0' are ignored">,
    835   InGroup<ExtraTokens>;
    836 def err_omp_unknown_directive : Error <
    837   "expected an OpenMP directive">;
    838 def err_omp_unexpected_directive : Error <
    839   "unexpected OpenMP directive '#pragma omp %0'">;
    840 def err_omp_expected_punc : Error <
    841   "expected ',' or ')' in %select{'#pragma omp %1'|'%1' clause}0">;
    842 def err_omp_unexpected_clause : Error <
    843   "unexpected OpenMP clause '%0' in directive '#pragma omp %1'">;
    844 def err_omp_more_one_clause : Error <
    845   "directive '#pragma omp %0' cannot contain more than one '%1' clause">;
    846 } // end of Parse Issue category.
    847 
    848 let CategoryName = "Modules Issue" in {
    849 def err_module_expected_ident : Error<
    850   "expected a module name after module import">;
    851 def err_module_expected_semi : Error<
    852   "expected ';' after module name">;
    853 }
    854 
    855 } // end of Parser diagnostics
    856