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
14let Component = "Parse" in {
15
16def w_asm_qualifier_ignored : Warning<"ignored %0 qualifier on asm">,
17                              CatInlineAsm;
18def warn_file_asm_volatile : Warning<
19  "meaningless 'volatile' on asm outside function">, CatInlineAsm;
20
21let CategoryName = "Inline Assembly Issue" in {
22def err_asm_empty : Error<"__asm used with no assembly instructions">;
23def err_inline_ms_asm_parsing : Error<"%0">;
24def err_msasm_unsupported_arch : Error<
25  "Unsupported architecture '%0' for MS-style inline assembly">;
26def err_msasm_unable_to_create_target : Error<
27  "MS-style inline assembly is not available: %0">;
28def err_gnu_inline_asm_disabled : Error<
29  "GNU-style inline assembly is disabled">;
30}
31
32let CategoryName = "Parse Issue" in {
33
34def ext_empty_translation_unit : Extension<
35  "ISO C requires a translation unit to contain at least one declaration">,
36  InGroup<DiagGroup<"empty-translation-unit">>;
37def warn_cxx98_compat_top_level_semi : Warning<
38  "extra ';' outside of a function is incompatible with C++98">,
39  InGroup<CXX98CompatPedantic>, DefaultIgnore;
40def ext_extra_semi : Extension<
41  "extra ';' %select{"
42  "outside of a function|"
43  "inside a %1|"
44  "inside instance variable list|"
45  "after member function definition}0">,
46  InGroup<ExtraSemi>;
47def ext_extra_semi_cxx11 : Extension<
48  "extra ';' outside of a function is a C++11 extension">,
49  InGroup<CXX11ExtraSemi>;
50def warn_extra_semi_after_mem_fn_def : Warning<
51  "extra ';' after member function definition">,
52  InGroup<ExtraSemi>, DefaultIgnore;
53
54def ext_thread_before : Extension<"'__thread' before '%0'">;
55def ext_keyword_as_ident : ExtWarn<
56  "keyword '%0' will be made available as an identifier "
57  "%select{here|for the remainder of the translation unit}1">,
58  InGroup<KeywordCompat>;
59
60def ext_nullability : Extension<
61  "type nullability specifier %0 is a Clang extension">,
62  InGroup<DiagGroup<"nullability-extension">>;
63
64def error_empty_enum : Error<"use of empty enum">;
65
66def ext_ident_list_in_param : Extension<
67  "type-less parameter names in function declaration">;
68def ext_c99_variable_decl_in_for_loop : Extension<
69  "variable declaration in for loop is a C99-specific feature">, InGroup<C99>;
70def ext_c99_compound_literal : Extension<
71  "compound literals are a C99-specific feature">, InGroup<C99>;
72def ext_enumerator_list_comma_c : Extension<
73  "commas at the end of enumerator lists are a C99-specific "
74  "feature">, InGroup<C99>;
75def ext_enumerator_list_comma_cxx : Extension<
76  "commas at the end of enumerator lists are a C++11 extension">,
77  InGroup<CXX11>;
78def warn_cxx98_compat_enumerator_list_comma : Warning<
79  "commas at the end of enumerator lists are incompatible with C++98">,
80  InGroup<CXX98CompatPedantic>, DefaultIgnore;
81def err_enumerator_list_missing_comma : Error<
82  "missing ',' between enumerators">;
83def err_enumerator_unnamed_no_def : Error<
84  "unnamed enumeration must be a definition">;
85def ext_cxx11_enum_fixed_underlying_type : Extension<
86  "enumeration types with a fixed underlying type are a C++11 extension">,
87  InGroup<CXX11>;
88def ext_c_enum_fixed_underlying_type : Extension<
89  "enumeration types with a fixed underlying type are a Microsoft extension">,
90  InGroup<MicrosoftFixedEnum>;
91def warn_cxx98_compat_enum_fixed_underlying_type : Warning<
92  "enumeration types with a fixed underlying type are incompatible with C++98">,
93  InGroup<CXX98Compat>, DefaultIgnore;
94def warn_cxx98_compat_alignof : Warning<
95  "alignof expressions are incompatible with C++98">,
96  InGroup<CXX98Compat>, DefaultIgnore;
97def ext_alignof_expr : ExtWarn<
98  "%0 applied to an expression is a GNU extension">, InGroup<GNUAlignofExpression>;
99
100def warn_microsoft_dependent_exists : Warning<
101  "dependent %select{__if_not_exists|__if_exists}0 declarations are ignored">,
102  InGroup<DiagGroup<"microsoft-exists">>;
103def warn_microsoft_qualifiers_ignored : Warning<
104  "qualifiers after comma in declarator list are ignored">,
105  InGroup<IgnoredAttributes>;
106
107def ext_c11_generic_selection : Extension<
108  "generic selections are a C11-specific feature">, InGroup<C11>;
109def err_duplicate_default_assoc : Error<
110  "duplicate default generic association">;
111def note_previous_default_assoc : Note<
112  "previous default generic association is here">;
113
114def ext_c11_alignment : Extension<
115  "%0 is a C11-specific feature">, InGroup<C11>;
116
117def ext_c11_noreturn : Extension<
118  "_Noreturn functions are a C11-specific feature">, InGroup<C11>;
119def err_c11_noreturn_misplaced : Error<
120  "'_Noreturn' keyword must precede function declarator">;
121
122def ext_gnu_indirect_goto : Extension<
123  "use of GNU indirect-goto extension">, InGroup<GNULabelsAsValue>;
124def ext_gnu_address_of_label : Extension<
125  "use of GNU address-of-label extension">, InGroup<GNULabelsAsValue>;
126def err_stmtexpr_file_scope : Error<
127  "statement expression not allowed at file scope">;
128def ext_gnu_statement_expr : Extension<
129  "use of GNU statement expression extension">, InGroup<GNUStatementExpression>;
130def ext_gnu_conditional_expr : Extension<
131  "use of GNU ?: conditional expression extension, omitting middle operand">, InGroup<GNUConditionalOmittedOperand>;
132def ext_gnu_empty_initializer : Extension<
133  "use of GNU empty initializer extension">, InGroup<GNUEmptyInitializer>;
134def ext_gnu_array_range : Extension<"use of GNU array range extension">,
135  InGroup<GNUDesignator>;
136def ext_gnu_missing_equal_designator : ExtWarn<
137  "use of GNU 'missing =' extension in designator">,
138  InGroup<GNUDesignator>;
139def err_expected_equal_designator : Error<"expected '=' or another designator">;
140def ext_gnu_old_style_field_designator : ExtWarn<
141  "use of GNU old-style field designator extension">,
142  InGroup<GNUDesignator>;
143def ext_gnu_case_range : Extension<"use of GNU case range extension">,
144  InGroup<GNUCaseRange>;
145
146// Generic errors.
147def err_expected_expression : Error<"expected expression">;
148def err_expected_type : Error<"expected a type">;
149def err_expected_external_declaration : Error<"expected external declaration">;
150def err_extraneous_closing_brace : Error<"extraneous closing brace ('}')">;
151def err_expected_semi_declaration : Error<
152  "expected ';' at end of declaration">;
153def err_expected_semi_decl_list : Error<
154  "expected ';' at end of declaration list">;
155def ext_expected_semi_decl_list : ExtWarn<
156  "expected ';' at end of declaration list">;
157def err_expected_member_name_or_semi : Error<
158  "expected member name or ';' after declaration specifiers">;
159def err_function_declared_typedef : Error<
160  "function definition declared 'typedef'">;
161def err_at_defs_cxx : Error<"@defs is not supported in Objective-C++">;
162def err_at_in_class : Error<"unexpected '@' in member specification">;
163def err_unexpected_semi : Error<"unexpected ';' before %0">;
164
165def err_expected_fn_body : Error<
166  "expected function body after function declarator">;
167def warn_attribute_on_function_definition : Warning<
168  "GCC does not allow %0 attribute in this position on a function definition">,
169  InGroup<GccCompat>;
170def warn_gcc_attribute_location : Warning<
171  "GCC does not allow an attribute in this position on a function declaration">,
172  InGroup<GccCompat>;
173def warn_attribute_no_decl : Warning<
174  "attribute %0 ignored, because it is not attached to a declaration">,
175  InGroup<IgnoredAttributes>;
176def err_expected_method_body : Error<"expected method body">;
177def err_declspec_after_virtspec : Error<
178  "'%0' qualifier may not appear after the virtual specifier '%1'">;
179def err_invalid_token_after_toplevel_declarator : Error<
180  "expected ';' after top level declarator">;
181def err_invalid_token_after_declarator_suggest_equal : Error<
182  "invalid %0 at end of declaration; did you mean '='?">;
183def err_expected_statement : Error<"expected statement">;
184def err_expected_lparen_after : Error<"expected '(' after '%0'">;
185def err_expected_rparen_after : Error<"expected ')' after '%0'">;
186def err_expected_punc : Error<"expected ')' or ',' after '%0'">;
187def err_expected_less_after : Error<"expected '<' after '%0'">;
188def err_expected_lbrace_in_compound_literal : Error<
189  "expected '{' in compound literal">;
190def err_expected_while : Error<"expected 'while' in do/while loop">;
191
192def err_expected_semi_after_stmt : Error<"expected ';' after %0 statement">;
193def err_expected_semi_after_expr : Error<"expected ';' after expression">;
194def err_extraneous_token_before_semi : Error<"extraneous '%0' before ';'">;
195
196def err_expected_semi_after_method_proto : Error<
197  "expected ';' after method prototype">;
198def err_expected_semi_after_namespace_name : Error<
199  "expected ';' after namespace name">;
200def err_unexpected_namespace_attributes_alias : Error<
201  "attributes cannot be specified on namespace alias">;
202def err_unexpected_nested_namespace_attribute : Error<
203  "attributes cannot be specified on a nested namespace definition">;
204def err_inline_namespace_alias : Error<"namespace alias cannot be inline">;
205def err_namespace_nonnamespace_scope : Error<
206  "namespaces can only be defined in global or namespace scope">;
207def ext_nested_namespace_definition : ExtWarn<
208  "nested namespace definition is a C++1z extension; "
209  "define each namespace separately">, InGroup<CXX1z>;
210def warn_cxx14_compat_nested_namespace_definition : Warning<
211  "nested namespace definition is incompatible with C++ standards before C++1z">,
212  InGroup<CXXPre1zCompat>, DefaultIgnore;
213def err_inline_nested_namespace_definition : Error<
214  "nested namespace definition cannot be 'inline'">;
215def err_expected_semi_after_attribute_list : Error<
216  "expected ';' after attribute list">;
217def err_expected_semi_after_static_assert : Error<
218  "expected ';' after static_assert">;
219def err_expected_semi_for : Error<"expected ';' in 'for' statement specifier">;
220def err_single_decl_assign_in_for_range : Error<
221  "range-based 'for' statement uses ':', not '='">;
222def warn_missing_selector_name : Warning<
223  "%0 used as the name of the previous parameter rather than as part "
224  "of the selector">,
225  InGroup<DiagGroup<"missing-selector-name">>;
226def note_missing_selector_name : Note<
227  "introduce a parameter name to make %0 part of the selector">;
228def note_force_empty_selector_name : Note<
229  "or insert whitespace before ':' to use %0 as parameter name "
230  "and have an empty entry in the selector">;
231def err_label_end_of_compound_statement : Error<
232  "label at end of compound statement: expected statement">;
233def err_address_of_label_outside_fn : Error<
234  "use of address-of-label extension outside of a function body">;
235def err_asm_operand_wide_string_literal : Error<
236  "cannot use %select{unicode|wide}0 string literal in 'asm'">;
237def err_expected_selector_for_method : Error<
238  "expected selector for Objective-C method">;
239def err_expected_property_name : Error<"expected property name">;
240
241def err_unexpected_at : Error<"unexpected '@' in program">;
242def err_atimport : Error<
243"use of '@import' when modules are disabled">;
244
245def err_invalid_reference_qualifier_application : Error<
246  "'%0' qualifier may not be applied to a reference">;
247def err_illegal_decl_reference_to_reference : Error<
248  "%0 declared as a reference to a reference">;
249def ext_rvalue_reference : ExtWarn<
250  "rvalue references are a C++11 extension">, InGroup<CXX11>;
251def warn_cxx98_compat_rvalue_reference : Warning<
252  "rvalue references are incompatible with C++98">,
253  InGroup<CXX98Compat>, DefaultIgnore;
254def ext_ref_qualifier : ExtWarn<
255  "reference qualifiers on functions are a C++11 extension">, InGroup<CXX11>;
256def warn_cxx98_compat_ref_qualifier : Warning<
257  "reference qualifiers on functions are incompatible with C++98">,
258  InGroup<CXX98Compat>, DefaultIgnore;
259def ext_inline_namespace : ExtWarn<
260  "inline namespaces are a C++11 feature">, InGroup<CXX11InlineNamespace>;
261def warn_cxx98_compat_inline_namespace : Warning<
262  "inline namespaces are incompatible with C++98">,
263  InGroup<CXX98Compat>, DefaultIgnore;
264def ext_generalized_initializer_lists : ExtWarn<
265  "generalized initializer lists are a C++11 extension">,
266  InGroup<CXX11>;
267def warn_cxx98_compat_generalized_initializer_lists : Warning<
268  "generalized initializer lists are incompatible with C++98">,
269  InGroup<CXX98Compat>, DefaultIgnore;
270def err_init_list_bin_op : Error<"initializer list cannot be used on the "
271  "%select{left|right}0 hand side of operator '%1'">;
272def warn_cxx98_compat_trailing_return_type : Warning<
273  "trailing return types are incompatible with C++98">,
274  InGroup<CXX98Compat>, DefaultIgnore;
275def ext_auto_storage_class : ExtWarn<
276  "'auto' storage class specifier is not permitted in C++11, and will not "
277  "be supported in future releases">, InGroup<DiagGroup<"auto-storage-class">>;
278def ext_decltype_auto_type_specifier : ExtWarn<
279  "'decltype(auto)' type specifier is a C++14 extension">, InGroup<CXX14>;
280def warn_cxx11_compat_decltype_auto_type_specifier : Warning<
281  "'decltype(auto)' type specifier is incompatible with C++ standards before "
282  "C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
283def ext_auto_type : Extension<
284  "'__auto_type' is a GNU extension">,
285  InGroup<GNUAutoType>;
286def ext_for_range : ExtWarn<
287  "range-based for loop is a C++11 extension">, InGroup<CXX11>;
288def warn_cxx98_compat_for_range : Warning<
289  "range-based for loop is incompatible with C++98">,
290  InGroup<CXX98Compat>, DefaultIgnore;
291def err_for_range_identifier : Error<
292  "range-based for loop requires type for loop variable">;
293def err_for_range_expected_decl : Error<
294  "for range declaration must declare a variable">;
295def err_argument_required_after_attribute : Error<
296  "argument required after attribute">;
297def err_missing_param : Error<"expected parameter declarator">;
298def err_missing_comma_before_ellipsis : Error<
299  "C requires a comma prior to the ellipsis in a variadic function type">;
300def err_unexpected_typedef_ident : Error<
301  "unexpected type name %0: expected identifier">;
302def warn_cxx98_compat_decltype : Warning<
303  "'decltype' type specifier is incompatible with C++98">,
304  InGroup<CXX98Compat>, DefaultIgnore;
305def err_unexpected_scope_on_base_decltype : Error<
306  "unexpected namespace scope prior to decltype">;
307def err_expected_class_name : Error<"expected class name">;
308def err_expected_class_name_not_template :
309  Error<"'typename' is redundant; base classes are implicitly types">;
310def err_unspecified_vla_size_with_static : Error<
311  "'static' may not be used with an unspecified variable length array size">;
312def err_unspecified_size_with_static : Error<
313  "'static' may not be used without an array size">;
314def err_expected_parentheses_around_typename : Error<
315  "expected parentheses around type name in %0 expression">;
316
317def err_expected_case_before_expression: Error<
318  "expected 'case' keyword before expression">;
319
320// Declarations.
321def err_typename_requires_specqual : Error<
322  "type name requires a specifier or qualifier">;
323def err_typename_invalid_storageclass : Error<
324  "type name does not allow storage class to be specified">;
325def err_typename_invalid_functionspec : Error<
326  "type name does not allow function specifier to be specified">;
327def err_typename_invalid_constexpr : Error<
328  "type name does not allow constexpr specifier to be specified">;
329def err_typename_identifiers_only : Error<
330  "typename is allowed for identifiers only">;
331
332def err_friend_invalid_in_context : Error<
333  "'friend' used outside of class">;
334def err_templated_using_directive_declaration : Error<
335  "cannot template a using %select{directive|declaration}0">;
336def err_unexpected_colon_in_nested_name_spec : Error<
337  "unexpected ':' in nested name specifier; did you mean '::'?">;
338def err_unexpected_token_in_nested_name_spec : Error<
339  "'%0' cannot be a part of nested name specifier; did you mean ':'?">;
340def err_bool_redeclaration : Error<
341  "redeclaration of C++ built-in type 'bool'">;
342def ext_c11_static_assert : Extension<
343  "_Static_assert is a C11-specific feature">, InGroup<C11>;
344def warn_cxx98_compat_static_assert : Warning<
345  "static_assert declarations are incompatible with C++98">,
346  InGroup<CXX98Compat>, DefaultIgnore;
347def err_paren_after_colon_colon : Error<
348  "unexpected parenthesis after '::'">;
349def err_function_definition_not_allowed : Error<
350  "function definition is not allowed here">;
351def err_expected_end_of_enumerator : Error<
352  "expected '= constant-expression' or end of enumerator definition">;
353def err_expected_coloncolon_after_super : Error<
354  "expected '::' after '__super'">;
355
356/// Objective-C parser diagnostics
357def err_expected_minus_or_plus : Error<
358  "method type specifier must start with '-' or '+'">;
359def err_objc_no_attributes_on_category : Error<
360  "attributes may not be specified on a category">;
361def err_objc_missing_end : Error<"missing '@end'">;
362def note_objc_container_start : Note<
363  "%select{class|protocol|category|class extension|implementation"
364  "|category implementation}0 started here">;
365def warn_objc_protocol_qualifier_missing_id : Warning<
366  "protocol has no object type specified; defaults to qualified 'id'">;
367def err_objc_unknown_at : Error<"expected an Objective-C directive after '@'">;
368def err_illegal_super_cast : Error<
369  "cannot cast 'super' (it isn't an expression)">;
370def err_nsnumber_nonliteral_unary : Error<
371  "@%0 must be followed by a number to form an NSNumber object">;
372def warn_cstyle_param : Warning<
373  "use of C-style parameters in Objective-C method declarations"
374  " is deprecated">, InGroup<DeprecatedDeclarations>;
375
376let CategoryName = "ARC Parse Issue" in {
377def err_arc_bridge_retain : Error<
378  "unknown cast annotation __bridge_retain; did you mean __bridge_retained?">;
379// To be default mapped to an error later.
380def warn_arc_bridge_cast_nonarc : Warning<
381  "'%0' casts have no effect when not using ARC">,
382  InGroup<DiagGroup<"arc-bridge-casts-disallowed-in-nonarc">>;
383}
384
385def err_objc_illegal_visibility_spec : Error<
386  "illegal visibility specification">;
387def err_objc_illegal_interface_qual : Error<"illegal interface qualifier">;
388def err_objc_expected_equal_for_getter : Error<
389  "expected '=' for Objective-C getter">;
390def err_objc_expected_equal_for_setter : Error<
391  "expected '=' for Objective-C setter">;
392def err_objc_expected_selector_for_getter_setter : Error<
393  "expected selector for Objective-C %select{setter|getter}0">;
394def err_objc_property_requires_field_name : Error<
395  "property requires fields to be named">;
396def err_objc_property_bitfield : Error<"property name cannot be a bitfield">;
397def err_objc_expected_property_attr : Error<"unknown property attribute %0">;
398def err_objc_properties_require_objc2 : Error<
399  "properties are an Objective-C 2 feature">;
400def err_objc_unexpected_attr : Error<
401  "prefix attribute must be followed by an interface or protocol">;
402def err_objc_postfix_attribute : Error <
403  "postfix attributes are not allowed on Objective-C directives">;
404def err_objc_postfix_attribute_hint : Error <
405  "postfix attributes are not allowed on Objective-C directives, place"
406  " them in front of '%select{@interface|@protocol}0'">;
407def err_objc_directive_only_in_protocol : Error<
408  "directive may only be specified in protocols only">;
409def err_missing_catch_finally : Error<
410  "@try statement without a @catch and @finally clause">;
411def err_objc_concat_string : Error<"unexpected token after Objective-C string">;
412def err_expected_objc_container : Error<
413  "'@end' must appear in an Objective-C context">;
414def err_unexpected_protocol_qualifier : Error<
415  "@implementation declaration cannot be protocol qualified">;
416def err_objc_unexpected_atend : Error<
417  "'@end' appears where closing brace '}' is expected">;
418def error_property_ivar_decl : Error<
419  "property synthesize requires specification of an ivar">;
420def err_synthesized_property_name : Error<
421  "expected a property name in @synthesize">;
422def warn_semicolon_before_method_body : Warning<
423  "semicolon before method body is ignored">,
424  InGroup<DiagGroup<"semicolon-before-method-body">>, DefaultIgnore;
425def note_extra_comma_message_arg : Note<
426  "comma separating Objective-C messaging arguments">;
427
428def err_expected_field_designator : Error<
429  "expected a field designator, such as '.field = 4'">;
430
431def err_declaration_does_not_declare_param : Error<
432  "declaration does not declare a parameter">;
433def err_no_matching_param : Error<"parameter named %0 is missing">;
434
435/// C++ parser diagnostics
436def err_invalid_operator_on_type : Error<
437  "cannot use %select{dot|arrow}0 operator on a type">;
438def err_expected_unqualified_id : Error<
439  "expected %select{identifier|unqualified-id}0">;
440def err_brackets_go_after_unqualified_id : Error<
441  "brackets are not allowed here; to declare an array, "
442  "place the brackets after the %select{identifier|name}0">;
443def err_unexpected_unqualified_id : Error<"type-id cannot have a name">;
444def err_func_def_no_params : Error<
445  "function definition does not declare parameters">;
446def err_expected_lparen_after_type : Error<
447  "expected '(' for function-style cast or type construction">;
448def err_expected_init_in_condition : Error<
449  "variable declaration in condition must have an initializer">;
450def err_expected_init_in_condition_lparen : Error<
451  "variable declaration in condition cannot have a parenthesized initializer">;
452def err_extraneous_rparen_in_condition : Error<
453  "extraneous ')' after condition, expected a statement">;
454def warn_dangling_else : Warning<
455  "add explicit braces to avoid dangling else">,
456  InGroup<DanglingElse>;
457def err_expected_member_or_base_name : Error<
458  "expected class member or base class name">;
459def err_expected_lbrace_after_base_specifiers : Error<
460  "expected '{' after base class list">;
461def err_missing_end_of_definition : Error<
462  "missing '}' at end of definition of %q0">;
463def note_missing_end_of_definition_before : Note<
464  "still within definition of %q0 here">;
465def ext_ellipsis_exception_spec : Extension<
466  "exception specification of '...' is a Microsoft extension">,
467  InGroup<MicrosoftExceptionSpec>;
468def err_dynamic_and_noexcept_specification : Error<
469  "cannot have both throw() and noexcept() clause on the same function">;
470def err_except_spec_unparsed : Error<
471  "unexpected end of exception specification">;
472def warn_cxx98_compat_noexcept_decl : Warning<
473  "noexcept specifications are incompatible with C++98">,
474  InGroup<CXX98Compat>, DefaultIgnore;
475def err_expected_catch : Error<"expected catch">;
476def err_using_namespace_in_class : Error<
477  "'using namespace' is not allowed in classes">;
478def err_constructor_bad_name : Error<
479  "missing return type for function %0; did you mean the constructor name %1?">;
480def err_destructor_tilde_identifier : Error<
481  "expected a class name after '~' to name a destructor">;
482def err_destructor_tilde_scope : Error<
483  "'~' in destructor name should be after nested name specifier">;
484def err_destructor_template_id : Error<
485  "destructor name %0 does not refer to a template">;
486def err_default_arg_unparsed : Error<
487  "unexpected end of default argument expression">;
488def err_bracket_depth_exceeded : Error<
489  "bracket nesting level exceeded maximum of %0">, DefaultFatal;
490def note_bracket_depth : Note<
491  "use -fbracket-depth=N to increase maximum nesting level">;
492def err_misplaced_ellipsis_in_declaration : Error<
493  "'...' must %select{immediately precede declared identifier|"
494  "be innermost component of anonymous pack declaration}0">;
495def warn_misplaced_ellipsis_vararg : Warning<
496  "'...' in this location creates a C-style varargs function"
497  "%select{, not a function parameter pack|}0">,
498  InGroup<DiagGroup<"ambiguous-ellipsis">>;
499def note_misplaced_ellipsis_vararg_existing_ellipsis : Note<
500  "preceding '...' declares a function parameter pack">;
501def note_misplaced_ellipsis_vararg_add_ellipsis : Note<
502  "place '...' %select{immediately before declared identifier|here}0 "
503  "to declare a function parameter pack">;
504def note_misplaced_ellipsis_vararg_add_comma : Note<
505  "insert ',' before '...' to silence this warning">;
506def ext_abstract_pack_declarator_parens : ExtWarn<
507  "ISO C++11 requires a parenthesized pack declaration to have a name">,
508  InGroup<DiagGroup<"anonymous-pack-parens">>;
509def err_function_is_not_record : Error<
510  "unexpected %0 in function call; perhaps remove the %0?">;
511def err_super_in_using_declaration : Error<
512  "'__super' cannot be used with a using declaration">;
513
514// C++ derived classes
515def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">;
516
517// C++ operator overloading
518def err_literal_operator_string_prefix : Error<
519  "string literal after 'operator' cannot have an encoding prefix">;
520def err_literal_operator_string_not_empty : Error<
521  "string literal after 'operator' must be '\"\"'">;
522def warn_cxx98_compat_literal_operator : Warning<
523  "literal operators are incompatible with C++98">,
524  InGroup<CXX98Compat>, DefaultIgnore;
525
526// Classes.
527def err_anon_type_definition : Error<
528  "declaration of anonymous %0 must be a definition">;
529def err_default_delete_in_multiple_declaration : Error<
530  "'= %select{default|delete}0' is a function definition and must occur in a "
531  "standalone declaration">;
532
533def warn_cxx98_compat_noexcept_expr : Warning<
534  "noexcept expressions are incompatible with C++98">,
535  InGroup<CXX98Compat>, DefaultIgnore;
536def warn_cxx98_compat_nullptr : Warning<
537  "'nullptr' is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
538
539def warn_cxx14_compat_attribute : Warning<
540  "attributes on %select{a namespace|an enumerator}0 declaration are "
541  "incompatible with C++ standards before C++1z">,
542  InGroup<CXXPre1zCompat>, DefaultIgnore;
543def warn_cxx98_compat_alignas : Warning<"'alignas' is incompatible with C++98">,
544  InGroup<CXX98Compat>, DefaultIgnore;
545def warn_cxx98_compat_attribute : Warning<
546  "C++11 attribute syntax is incompatible with C++98">,
547  InGroup<CXX98Compat>, DefaultIgnore;
548def err_cxx11_attribute_forbids_arguments : Error<
549  "attribute %0 cannot have an argument list">;
550def err_attribute_requires_arguments : Error<
551  "parentheses must be omitted if %0 attribute's argument list is empty">;
552def err_cxx11_attribute_forbids_ellipsis : Error<
553  "attribute '%0' cannot be used as an attribute pack">;
554def err_cxx11_attribute_repeated : Error<
555  "attribute %0 cannot appear multiple times in an attribute specifier">;
556def err_attributes_not_allowed : Error<"an attribute list cannot appear here">;
557def err_l_square_l_square_not_attribute : Error<
558  "C++11 only allows consecutive left square brackets when "
559  "introducing an attribute">;
560def err_ms_declspec_type : Error<
561  "__declspec attributes must be an identifier or string literal">;
562def err_ms_property_no_getter_or_putter : Error<
563  "property does not specify a getter or a putter">;
564def err_ms_property_unknown_accessor : Error<
565  "expected 'get' or 'put' in property declaration">;
566def err_ms_property_has_set_accessor : Error<
567  "putter for property must be specified as 'put', not 'set'">;
568def err_ms_property_missing_accessor_kind : Error<
569  "missing 'get=' or 'put='">;
570def err_ms_property_expected_equal : Error<
571  "expected '=' after '%0'">;
572def err_ms_property_duplicate_accessor : Error<
573  "property declaration specifies '%0' accessor twice">;
574def err_ms_property_expected_accessor_name : Error<
575  "expected name of accessor method">;
576def err_ms_property_expected_comma_or_rparen : Error<
577  "expected ',' or ')' at end of property accessor list">;
578def err_ms_property_initializer : Error<
579  "property declaration cannot have an in-class initializer">;
580
581/// C++ Templates
582def err_expected_template : Error<"expected template">;
583def err_unknown_template_name : Error<
584  "unknown template name %0">;
585def err_expected_comma_greater : Error<
586  "expected ',' or '>' in template-parameter-list">;
587def err_class_on_template_template_param : Error<
588  "template template parameter requires 'class' after the parameter list">;
589def ext_template_template_param_typename : ExtWarn<
590  "template template parameter using 'typename' is a C++1z extension">,
591  InGroup<CXX1z>;
592def warn_cxx14_compat_template_template_param_typename : Warning<
593  "template template parameter using 'typename' is "
594  "incompatible with C++ standards before C++1z">,
595  InGroup<CXXPre1zCompat>, DefaultIgnore;
596def err_template_spec_syntax_non_template : Error<
597  "identifier followed by '<' indicates a class template specialization but "
598  "%0 %select{does not refer to a template|refers to a function template|"
599  "<unused>|refers to a variable template|<unused>}1">;
600def err_id_after_template_in_nested_name_spec : Error<
601  "expected template name after 'template' keyword in nested name specifier">;
602def err_two_right_angle_brackets_need_space : Error<
603  "a space is required between consecutive right angle brackets (use '> >')">;
604def err_right_angle_bracket_equal_needs_space : Error<
605  "a space is required between a right angle bracket and an equals sign "
606  "(use '> =')">;
607def warn_cxx11_right_shift_in_template_arg : Warning<
608  "use of right-shift operator ('>>') in template argument will require "
609  "parentheses in C++11">, InGroup<CXX11Compat>;
610def warn_cxx98_compat_two_right_angle_brackets : Warning<
611  "consecutive right angle brackets are incompatible with C++98 (use '> >')">,
612  InGroup<CXX98Compat>, DefaultIgnore;
613def err_templated_invalid_declaration : Error<
614  "a static_assert declaration cannot be a template">;
615def err_multiple_template_declarators : Error<
616  "%select{|a template declaration|an explicit template specialization|"
617  "an explicit template instantiation}0 can "
618  "only %select{|declare|declare|instantiate}0 a single entity">;
619def err_explicit_instantiation_with_definition : Error<
620  "explicit template instantiation cannot have a definition; if this "
621  "definition is meant to be an explicit specialization, add '<>' after the "
622  "'template' keyword">;
623def err_template_defn_explicit_instantiation : Error<
624  "%select{function|class|variable}0 cannot be defined in an explicit instantiation; if this "
625  "declaration is meant to be a %select{function|class|variable}0 definition, remove the 'template' keyword">;
626def err_friend_explicit_instantiation : Error<
627  "friend cannot be declared in an explicit instantiation; if this "
628  "declaration is meant to be a friend declaration, remove the 'template' keyword">;
629def err_explicit_instantiation_enum : Error<
630  "enumerations cannot be explicitly instantiated">;
631def err_expected_template_parameter : Error<"expected template parameter">;
632
633def err_missing_dependent_template_keyword : Error<
634  "use 'template' keyword to treat '%0' as a dependent template name">;
635def warn_missing_dependent_template_keyword : ExtWarn<
636  "use 'template' keyword to treat '%0' as a dependent template name">;
637
638def ext_extern_template : Extension<
639  "extern templates are a C++11 extension">, InGroup<CXX11>;
640def warn_cxx98_compat_extern_template : Warning<
641  "extern templates are incompatible with C++98">,
642  InGroup<CXX98CompatPedantic>, DefaultIgnore;
643def warn_static_inline_explicit_inst_ignored : Warning<
644  "ignoring '%select{static|inline}0' keyword on explicit template "
645  "instantiation">, InGroup<DiagGroup<"static-inline-explicit-instantiation">>;
646
647// Constructor template diagnostics.
648def err_out_of_line_constructor_template_id : Error<
649  "out-of-line constructor for %0 cannot have template arguments">;
650def err_out_of_line_template_id_type_names_constructor : Error<
651  "qualified reference to %0 is a constructor name rather than a "
652  "%select{template name|type}1 wherever a constructor can be declared">;
653
654def err_expected_qualified_after_typename : Error<
655  "expected a qualified name after 'typename'">;
656def warn_expected_qualified_after_typename : ExtWarn<
657  "expected a qualified name after 'typename'">;
658
659def err_typename_refers_to_non_type_template : Error<
660  "typename specifier refers to a non-type template">;
661def err_expected_type_name_after_typename : Error<
662  "expected an identifier or template-id after '::'">;
663def err_explicit_spec_non_template : Error<
664  "explicit %select{specialization|instantiation}0 of non-template %1 %2">;
665
666def err_default_template_template_parameter_not_template : Error<
667  "default template argument for a template template parameter must be a class "
668  "template">;
669
670def ext_fold_expression : ExtWarn<
671  "pack fold expression is a C++1z extension">,
672  InGroup<CXX1z>;
673def warn_cxx14_compat_fold_expression : Warning<
674  "pack fold expression is incompatible with C++ standards before C++1z">,
675  InGroup<CXXPre1zCompat>, DefaultIgnore;
676def err_expected_fold_operator : Error<
677  "expected a foldable binary operator in fold expression">;
678def err_fold_operator_mismatch : Error<
679  "operators in fold expression must be the same">;
680
681def err_ctor_init_missing_comma : Error<
682  "missing ',' between base or member initializers">;
683
684// C++ declarations
685def err_friend_decl_defines_type : Error<
686  "cannot define a type in a friend declaration">;
687def err_missing_whitespace_digraph : Error<
688  "found '<::' after a "
689  "%select{template name|const_cast|dynamic_cast|reinterpret_cast|static_cast}0"
690  " which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?">;
691
692def ext_defaulted_deleted_function : ExtWarn<
693  "%select{defaulted|deleted}0 function definitions are a C++11 extension">,
694  InGroup<CXX11>;
695def warn_cxx98_compat_defaulted_deleted_function : Warning<
696  "%select{defaulted|deleted}0 function definitions are incompatible with C++98">,
697  InGroup<CXX98Compat>, DefaultIgnore;
698
699// C++11 in-class member initialization
700def ext_nonstatic_member_init : ExtWarn<
701  "in-class initialization of non-static data member is a C++11 extension">,
702  InGroup<CXX11>;
703def warn_cxx98_compat_nonstatic_member_init : Warning<
704  "in-class initialization of non-static data members is incompatible with C++98">,
705  InGroup<CXX98Compat>, DefaultIgnore;
706def err_bitfield_member_init: Error<
707  "bitfield member cannot have an in-class initializer">;
708def err_incomplete_array_member_init: Error<
709  "array bound cannot be deduced from an in-class initializer">;
710
711// C++11 alias-declaration
712def ext_alias_declaration : ExtWarn<
713  "alias declarations are a C++11 extension">, InGroup<CXX11>;
714def warn_cxx98_compat_alias_declaration : Warning<
715  "alias declarations are incompatible with C++98">,
716  InGroup<CXX98Compat>, DefaultIgnore;
717def err_alias_declaration_not_identifier : Error<
718  "name defined in alias declaration must be an identifier">;
719def err_alias_declaration_specialization : Error<
720  "%select{partial specialization|explicit specialization|explicit instantiation}0 of alias templates is not permitted">;
721
722// C++11 override control
723def ext_override_control_keyword : ExtWarn<
724  "'%0' keyword is a C++11 extension">, InGroup<CXX11>;
725def warn_cxx98_compat_override_control_keyword : Warning<
726  "'%0' keyword is incompatible with C++98">,
727  InGroup<CXX98Compat>, DefaultIgnore;
728def err_override_control_interface : Error<
729  "'%0' keyword not permitted with interface types">;
730def ext_ms_sealed_keyword : ExtWarn<
731  "'sealed' keyword is a Microsoft extension">,
732  InGroup<MicrosoftSealed>;
733
734def err_access_specifier_interface : Error<
735  "interface types cannot specify '%select{private|protected}0' access">;
736
737def err_duplicate_virt_specifier : Error<
738  "class member already marked '%0'">;
739
740def err_scoped_enum_missing_identifier : Error<
741  "scoped enumeration requires a name">;
742def ext_scoped_enum : ExtWarn<
743  "scoped enumerations are a C++11 extension">, InGroup<CXX11>;
744def warn_cxx98_compat_scoped_enum : Warning<
745  "scoped enumerations are incompatible with C++98">,
746  InGroup<CXX98Compat>, DefaultIgnore;
747
748def err_expected_parameter_pack : Error<
749  "expected the name of a parameter pack">;
750def err_paren_sizeof_parameter_pack : Error<
751  "missing parentheses around the size of parameter pack %0">;
752def err_sizeof_parameter_pack : Error<
753  "expected parenthesized parameter pack name in 'sizeof...' expression">;
754
755// C++11 lambda expressions
756def err_expected_comma_or_rsquare : Error<
757  "expected ',' or ']' in lambda capture list">;
758def err_this_captured_by_reference : Error<
759  "'this' cannot be captured by reference">;
760def err_expected_capture : Error<
761  "expected variable name or 'this' in lambda capture list">;
762def err_expected_lambda_body : Error<"expected body of lambda expression">;
763def warn_cxx98_compat_lambda : Warning<
764  "lambda expressions are incompatible with C++98">,
765  InGroup<CXX98Compat>, DefaultIgnore;
766def err_lambda_missing_parens : Error<
767  "lambda requires '()' before %select{'mutable'|return type|"
768  "attribute specifier}0">;
769
770// Availability attribute
771def err_expected_version : Error<
772  "expected a version of the form 'major[.minor[.subminor]]'">;
773def warn_expected_consistent_version_separator : Warning<
774  "use same version number separators '_' or '.'; as in "
775  "'major[.minor[.subminor]]'">, InGroup<Availability>;
776def err_zero_version : Error<
777  "version number must have non-zero major, minor, or sub-minor version">;
778def err_availability_expected_platform : Error<
779  "expected a platform name, e.g., 'macosx'">;
780
781// objc_bridge_related attribute
782def err_objcbridge_related_expected_related_class : Error<
783  "expected a related ObjectiveC class name, e.g., 'NSColor'">;
784def err_objcbridge_related_selector_name : Error<
785  "expected a class method selector with single argument, e.g., 'colorWithCGColor:'">;
786
787def err_availability_expected_change : Error<
788  "expected 'introduced', 'deprecated', or 'obsoleted'">;
789def err_availability_unknown_change : Error<
790  "%0 is not an availability stage; use 'introduced', 'deprecated', or "
791  "'obsoleted'">;
792def err_availability_redundant : Error<
793  "redundant %0 availability change; only the last specified change will "
794  "be used">;
795def warn_availability_and_unavailable : Warning<
796  "'unavailable' availability overrides all other availability information">,
797  InGroup<Availability>;
798
799// Type safety attributes
800def err_type_safety_unknown_flag : Error<
801  "invalid comparison flag %0; use 'layout_compatible' or 'must_be_null'">;
802
803// Type traits
804def err_type_trait_arity : Error<
805  "type trait requires %0%select{| or more}1 argument%select{|s}2; have "
806  "%3 argument%s3">;
807
808// Language specific pragmas
809// - Generic warnings
810def warn_pragma_expected_lparen : Warning<
811  "missing '(' after '#pragma %0' - ignoring">, InGroup<IgnoredPragmas>;
812def warn_pragma_expected_rparen : Warning<
813  "missing ')' after '#pragma %0' - ignoring">, InGroup<IgnoredPragmas>;
814def warn_pragma_expected_identifier : Warning<
815  "expected identifier in '#pragma %0' - ignored">, InGroup<IgnoredPragmas>;
816def warn_pragma_expected_section_name : Warning<
817  "expected a string literal for the section name in '#pragma %0' - ignored">,
818  InGroup<IgnoredPragmas>;
819def warn_pragma_expected_section_push_pop_or_name : Warning<
820  "expected push, pop or a string literal for the section name in '#pragma %0' - ignored">,
821  InGroup<IgnoredPragmas>;
822def warn_pragma_expected_section_label_or_name : Warning<
823  "expected a stack label or a string literal for the section name in '#pragma %0' - ignored">,
824  InGroup<IgnoredPragmas>;
825def warn_pragma_expected_init_seg : Warning<
826  "expected 'compiler', 'lib', 'user', or a string literal for the section name in '#pragma %0' - ignored">,
827  InGroup<IgnoredPragmas>;
828def warn_pragma_expected_integer : Warning<
829  "expected integer between %0 and %1 inclusive in '#pragma %2' - ignored">,
830  InGroup<IgnoredPragmas>;
831def warn_pragma_ms_struct : Warning<
832  "incorrect use of '#pragma ms_struct on|off' - ignored">,
833  InGroup<IgnoredPragmas>;
834def warn_pragma_extra_tokens_at_eol : Warning<
835  "extra tokens at end of '#pragma %0' - ignored">,
836  InGroup<IgnoredPragmas>;
837def warn_pragma_expected_punc : Warning<
838  "expected ')' or ',' in '#pragma %0'">, InGroup<IgnoredPragmas>;
839def warn_pragma_expected_non_wide_string : Warning<
840  "expected non-wide string literal in '#pragma %0'">, InGroup<IgnoredPragmas>;
841// - Generic errors
842def err_pragma_missing_argument : Error<
843  "missing argument to '#pragma %0'%select{|; expected %2}1">;
844// - #pragma options
845def warn_pragma_options_expected_align : Warning<
846  "expected 'align' following '#pragma options' - ignored">,
847  InGroup<IgnoredPragmas>;
848def warn_pragma_align_expected_equal : Warning<
849  "expected '=' following '#pragma %select{align|options align}0' - ignored">,
850  InGroup<IgnoredPragmas>;
851def warn_pragma_align_invalid_option : Warning<
852  "invalid alignment option in '#pragma %select{align|options align}0' - ignored">,
853  InGroup<IgnoredPragmas>;
854// - #pragma pack
855def warn_pragma_unsupported_action : Warning<
856  "known but unsupported action '%1' for '#pragma %0' - ignored">,
857  InGroup<IgnoredPragmas>;
858def warn_pragma_invalid_specific_action : Warning<
859  "unknown action '%1' for '#pragma %0' - ignored">,
860  InGroup<IgnoredPragmas>;
861def warn_pragma_expected_action_or_r_paren : Warning<
862  "expected action or ')' in '#pragma %0' - ignored">,
863  InGroup<IgnoredPragmas>;
864def warn_pragma_invalid_action : Warning<
865  "unknown action for '#pragma %0' - ignored">,
866  InGroup<IgnoredPragmas>;
867def warn_pragma_pack_malformed : Warning<
868  "expected integer or identifier in '#pragma pack' - ignored">,
869  InGroup<IgnoredPragmas>;
870// - #pragma unused
871def warn_pragma_unused_expected_var : Warning<
872  "expected '#pragma unused' argument to be a variable name">,
873  InGroup<IgnoredPragmas>;
874// - #pragma init_seg
875def warn_pragma_init_seg_unsupported_target : Warning<
876  "'#pragma init_seg' is only supported when targeting a "
877  "Microsoft environment">,
878  InGroup<IgnoredPragmas>;
879// - #pragma fp_contract
880def err_pragma_fp_contract_scope : Error<
881  "'#pragma fp_contract' can only appear at file scope or at the start of a "
882  "compound statement">;
883// - #pragma comment
884def err_pragma_comment_malformed : Error<
885  "pragma comment requires parenthesized identifier and optional string">;
886def err_pragma_comment_unknown_kind : Error<"unknown kind of pragma comment">;
887// PS4 recognizes only #pragma comment(lib)
888def warn_pragma_comment_ignored : Warning<"'#pragma comment %0' ignored">,
889  InGroup<IgnoredPragmas>;
890// - #pragma detect_mismatch
891def err_pragma_detect_mismatch_malformed : Error<
892  "pragma detect_mismatch is malformed; it requires two comma-separated "
893  "string literals">;
894// - #pragma pointers_to_members
895def err_pragma_pointers_to_members_unknown_kind : Error<
896  "unexpected %0, expected to see one of %select{|'best_case', 'full_generality', }1"
897  "'single_inheritance', 'multiple_inheritance', or 'virtual_inheritance'">;
898// - #pragma clang optimize on/off
899def err_pragma_optimize_invalid_argument : Error<
900  "unexpected argument '%0' to '#pragma clang optimize'; "
901  "expected 'on' or 'off'">;
902def err_pragma_optimize_extra_argument : Error<
903  "unexpected extra argument '%0' to '#pragma clang optimize'">;
904
905// OpenCL EXTENSION pragma (OpenCL 1.1 [9.1])
906def warn_pragma_expected_colon : Warning<
907  "missing ':' after %0 - ignoring">, InGroup<IgnoredPragmas>;
908def warn_pragma_expected_enable_disable : Warning<
909  "expected 'enable' or 'disable' - ignoring">, InGroup<IgnoredPragmas>;
910def warn_pragma_unknown_extension : Warning<
911  "unknown OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>;
912
913// OpenMP support.
914def warn_pragma_omp_ignored : Warning<
915  "unexpected '#pragma omp ...' in program">, InGroup<SourceUsesOpenMP>, DefaultIgnore;
916def warn_omp_extra_tokens_at_eol : Warning<
917  "extra tokens at the end of '#pragma omp %0' are ignored">,
918  InGroup<ExtraTokens>;
919def warn_pragma_expected_colon_r_paren : Warning<
920  "missing ':' or ')' after %0 - ignoring">, InGroup<IgnoredPragmas>;
921def err_omp_unknown_directive : Error<
922  "expected an OpenMP directive">;
923def err_omp_unexpected_directive : Error<
924  "unexpected OpenMP directive '#pragma omp %0'">;
925def err_omp_expected_punc : Error<
926  "expected ',' or ')' in '%0' %select{clause|directive}1">;
927def err_omp_unexpected_clause : Error<
928  "unexpected OpenMP clause '%0' in directive '#pragma omp %1'">;
929def err_omp_immediate_directive : Error<
930  "'#pragma omp %0' %select{|with '%2' clause }1cannot be an immediate substatement">;
931def err_omp_expected_identifier_for_critical : Error<
932  "expected identifier specifying the name of the 'omp critical' directive">;
933def err_omp_unknown_map_type : Error<
934  "incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'">;
935def err_omp_unknown_map_type_modifier : Error<
936  "incorrect map type modifier, expected 'always'">;
937def err_omp_map_type_missing : Error<
938  "missing map type">;
939
940// Pragma loop support.
941def err_pragma_loop_missing_argument : Error<
942  "missing argument; expected %select{an integer value|"
943  "'enable', %select{'assume_safety'|'full'}1 or 'disable'}0">;
944def err_pragma_loop_invalid_option : Error<
945  "%select{invalid|missing}0 option%select{ %1|}0; expected vectorize, "
946  "vectorize_width, interleave, interleave_count, unroll, or unroll_count">;
947def err_pragma_invalid_keyword : Error<
948  "invalid argument; expected 'enable', %select{'assume_safety'|'full'}0 or 'disable'">;
949
950// Pragma unroll support.
951def warn_pragma_unroll_cuda_value_in_parens : Warning<
952  "argument to '#pragma unroll' should not be in parentheses in CUDA C/C++">,
953  InGroup<CudaCompat>;
954} // end of Parse Issue category.
955
956let CategoryName = "Modules Issue" in {
957def err_module_expected_ident : Error<
958  "expected a module name after module import">;
959def err_module_expected_semi : Error<
960  "expected ';' after module name">;
961def err_missing_before_module_end : Error<"expected %0 at end of module">;
962}
963
964let CategoryName = "Generics Issue" in {
965
966def err_objc_expected_type_parameter : Error<
967  "expected type parameter name">;
968
969def err_objc_parameterized_implementation : Error<
970  "@implementation cannot have type parameters">;
971
972def err_objc_type_args_after_protocols : Error<
973  "protocol qualifiers must precede type arguments">;
974}
975
976let CategoryName = "Coroutines Issue" in {
977def err_for_co_await_not_range_for : Error<
978  "'co_await' modifier can only be applied to range-based for loop">;
979}
980
981} // end of Parser diagnostics
982