DiagnosticParseKinds.td revision 360784
1//==--- DiagnosticParseKinds.td - libparse diagnostics --------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9//===----------------------------------------------------------------------===//
10// Parser Diagnostics
11//===----------------------------------------------------------------------===//
12
13let Component = "Parse" in {
14
15def warn_asm_qualifier_ignored : Warning<
16  "ignored %0 qualifier on asm">, CatInlineAsm, InGroup<ASMIgnoredQualifier>;
17def warn_file_asm_volatile : Warning<
18  "meaningless 'volatile' on asm outside function">, CatInlineAsm,
19  InGroup<ASMIgnoredQualifier>;
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">;
30def err_asm_goto_cannot_have_output : Error<
31  "'asm goto' cannot have output constraints">;
32}
33
34let CategoryName = "Parse Issue" in {
35
36def ext_empty_translation_unit : Extension<
37  "ISO C requires a translation unit to contain at least one declaration">,
38  InGroup<DiagGroup<"empty-translation-unit">>;
39def warn_cxx98_compat_top_level_semi : Warning<
40  "extra ';' outside of a function is incompatible with C++98">,
41  InGroup<CXX98CompatExtraSemi>, DefaultIgnore;
42def ext_extra_semi : Extension<
43  "extra ';' %select{"
44  "outside of a function|"
45  "inside a %1|"
46  "inside instance variable list|"
47  "after member function definition}0">,
48  InGroup<ExtraSemi>;
49def ext_extra_semi_cxx11 : Extension<
50  "extra ';' outside of a function is a C++11 extension">,
51  InGroup<CXX11ExtraSemi>;
52def warn_extra_semi_after_mem_fn_def : Warning<
53  "extra ';' after member function definition">,
54  InGroup<ExtraSemi>, DefaultIgnore;
55def warn_null_statement : Warning<
56  "empty expression statement has no effect; "
57  "remove unnecessary ';' to silence this warning">,
58  InGroup<ExtraSemiStmt>, DefaultIgnore;
59
60def warn_misleading_indentation : Warning<
61  "misleading indentation; statement is not part of "
62  "the previous '%select{if|else|for|while}0'">,
63  InGroup<MisleadingIndentation>, DefaultIgnore;
64def note_previous_statement : Note<
65  "previous statement is here">;
66
67def ext_thread_before : Extension<"'__thread' before '%0'">;
68def ext_keyword_as_ident : ExtWarn<
69  "keyword '%0' will be made available as an identifier "
70  "%select{here|for the remainder of the translation unit}1">,
71  InGroup<KeywordCompat>;
72
73def ext_nullability : Extension<
74  "type nullability specifier %0 is a Clang extension">,
75  InGroup<DiagGroup<"nullability-extension">>;
76
77def err_empty_enum : Error<"use of empty enum">;
78
79def ext_ident_list_in_param : Extension<
80  "type-less parameter names in function declaration">;
81def ext_c99_variable_decl_in_for_loop : Extension<
82  "variable declaration in for loop is a C99-specific feature">, InGroup<C99>;
83def ext_c99_compound_literal : Extension<
84  "compound literals are a C99-specific feature">, InGroup<C99>;
85def ext_enumerator_list_comma_c : Extension<
86  "commas at the end of enumerator lists are a C99-specific "
87  "feature">, InGroup<C99>;
88def ext_enumerator_list_comma_cxx : Extension<
89  "commas at the end of enumerator lists are a C++11 extension">,
90  InGroup<CXX11>;
91def warn_cxx98_compat_enumerator_list_comma : Warning<
92  "commas at the end of enumerator lists are incompatible with C++98">,
93  InGroup<CXX98CompatPedantic>, DefaultIgnore;
94def err_enumerator_list_missing_comma : Error<
95  "missing ',' between enumerators">;
96def err_enumerator_unnamed_no_def : Error<
97  "unnamed enumeration must be a definition">;
98def ext_cxx11_enum_fixed_underlying_type : Extension<
99  "enumeration types with a fixed underlying type are a C++11 extension">,
100  InGroup<CXX11>;
101def ext_ms_c_enum_fixed_underlying_type : Extension<
102  "enumeration types with a fixed underlying type are a Microsoft extension">,
103  InGroup<MicrosoftFixedEnum>;
104def ext_clang_c_enum_fixed_underlying_type : Extension<
105  "enumeration types with a fixed underlying type are a Clang extension">,
106  InGroup<DiagGroup<"fixed-enum-extension">>;
107def warn_cxx98_compat_enum_fixed_underlying_type : Warning<
108  "enumeration types with a fixed underlying type are incompatible with C++98">,
109  InGroup<CXX98Compat>, DefaultIgnore;
110def warn_cxx98_compat_alignof : Warning<
111  "alignof expressions are incompatible with C++98">,
112  InGroup<CXX98Compat>, DefaultIgnore;
113def ext_alignof_expr : ExtWarn<
114  "%0 applied to an expression is a GNU extension">, InGroup<GNUAlignofExpression>;
115def err_lambda_after_delete : Error<
116  "'[]' after delete interpreted as 'delete[]'; add parentheses to treat this as a lambda-expression">;
117
118def warn_microsoft_dependent_exists : Warning<
119  "dependent %select{__if_not_exists|__if_exists}0 declarations are ignored">,
120  InGroup<DiagGroup<"microsoft-exists">>;
121def warn_microsoft_qualifiers_ignored : Warning<
122  "qualifiers after comma in declarator list are ignored">,
123  InGroup<IgnoredAttributes>;
124
125def err_duplicate_default_assoc : Error<
126  "duplicate default generic association">;
127def note_previous_default_assoc : Note<
128  "previous default generic association is here">;
129
130def ext_c99_feature : Extension<
131  "'%0' is a C99 extension">, InGroup<C99>;
132def ext_c11_feature : Extension<
133  "'%0' is a C11 extension">, InGroup<C11>;
134
135def err_c11_noreturn_misplaced : Error<
136  "'_Noreturn' keyword must precede function declarator">;
137
138def ext_gnu_indirect_goto : Extension<
139  "use of GNU indirect-goto extension">, InGroup<GNULabelsAsValue>;
140def ext_gnu_address_of_label : Extension<
141  "use of GNU address-of-label extension">, InGroup<GNULabelsAsValue>;
142def err_stmtexpr_file_scope : Error<
143  "statement expression not allowed at file scope">;
144def ext_gnu_statement_expr : Extension<
145  "use of GNU statement expression extension">, InGroup<GNUStatementExpression>;
146def ext_gnu_conditional_expr : Extension<
147  "use of GNU ?: conditional expression extension, omitting middle operand">, InGroup<GNUConditionalOmittedOperand>;
148def ext_gnu_empty_initializer : Extension<
149  "use of GNU empty initializer extension">, InGroup<GNUEmptyInitializer>;
150def ext_gnu_array_range : Extension<"use of GNU array range extension">,
151  InGroup<GNUDesignator>;
152def ext_gnu_missing_equal_designator : ExtWarn<
153  "use of GNU 'missing =' extension in designator">,
154  InGroup<GNUDesignator>;
155def err_expected_equal_designator : Error<"expected '=' or another designator">;
156def ext_gnu_old_style_field_designator : ExtWarn<
157  "use of GNU old-style field designator extension">,
158  InGroup<GNUDesignator>;
159def ext_gnu_case_range : Extension<"use of GNU case range extension">,
160  InGroup<GNUCaseRange>;
161
162// Generic errors.
163def err_expected_expression : Error<"expected expression">;
164def err_expected_type : Error<"expected a type">;
165def err_expected_external_declaration : Error<"expected external declaration">;
166def err_extraneous_closing_brace : Error<"extraneous closing brace ('}')">;
167def err_expected_semi_declaration : Error<
168  "expected ';' at end of declaration">;
169def err_expected_semi_decl_list : Error<
170  "expected ';' at end of declaration list">;
171def ext_expected_semi_decl_list : ExtWarn<
172  "expected ';' at end of declaration list">;
173def err_expected_member_name_or_semi : Error<
174  "expected member name or ';' after declaration specifiers">;
175def err_function_declared_typedef : Error<
176  "function definition declared 'typedef'">;
177def err_at_defs_cxx : Error<"@defs is not supported in Objective-C++">;
178def err_at_in_class : Error<"unexpected '@' in member specification">;
179def err_unexpected_semi : Error<"unexpected ';' before %0">;
180def err_unparenthesized_non_primary_expr_in_requires_clause : Error<
181  "parentheses are required around this expression in a requires clause">;
182def note_unparenthesized_non_primary_expr_in_requires_clause : Note<
183  "parentheses are required around this expression in a requires clause">;
184def err_potential_function_call_in_constraint_logical_or : Error<
185  "function call must be parenthesized to be considered part of the requires "
186  "clause">;
187
188def err_expected_fn_body : Error<
189  "expected function body after function declarator">;
190def warn_attribute_on_function_definition : Warning<
191  "GCC does not allow %0 attribute in this position on a function definition">,
192  InGroup<GccCompat>;
193def warn_gcc_attribute_location : Warning<
194  "GCC does not allow an attribute in this position on a function declaration">,
195  InGroup<GccCompat>;
196def warn_gcc_variable_decl_in_for_loop : Warning<
197  "GCC does not allow variable declarations in for loop initializers before "
198  "C99">, InGroup<GccCompat>;
199def warn_attribute_no_decl : Warning<
200  "attribute %0 ignored, because it is not attached to a declaration">,
201  InGroup<IgnoredAttributes>;
202def err_ms_attributes_not_enabled : Error<
203  "'__declspec' attributes are not enabled; use '-fdeclspec' or "
204  "'-fms-extensions' to enable support for __declspec attributes">;
205def err_expected_method_body : Error<"expected method body">;
206def err_declspec_after_virtspec : Error<
207  "'%0' qualifier may not appear after the virtual specifier '%1'">;
208def err_invalid_token_after_toplevel_declarator : Error<
209  "expected ';' after top level declarator">;
210def err_invalid_token_after_declarator_suggest_equal : Error<
211  "invalid %0 at end of declaration; did you mean '='?">;
212def err_expected_statement : Error<"expected statement">;
213def err_expected_lparen_after : Error<"expected '(' after '%0'">;
214def err_expected_lbrace_after : Error<"expected '{' after '%0'">;
215def err_expected_rparen_after : Error<"expected ')' after '%0'">;
216def err_expected_punc : Error<"expected ')' or ',' after '%0'">;
217def err_expected_less_after : Error<"expected '<' after '%0'">;
218def err_expected_lbrace_in_compound_literal : Error<
219  "expected '{' in compound literal">;
220def err_expected_while : Error<"expected 'while' in do/while loop">;
221
222def err_expected_semi_after_stmt : Error<"expected ';' after %0 statement">;
223def err_expected_semi_after_expr : Error<"expected ';' after expression">;
224def err_extraneous_token_before_semi : Error<"extraneous '%0' before ';'">;
225
226def err_expected_semi_after_method_proto : Error<
227  "expected ';' after method prototype">;
228def err_expected_semi_after_namespace_name : Error<
229  "expected ';' after namespace name">;
230def err_unexpected_namespace_attributes_alias : Error<
231  "attributes cannot be specified on namespace alias">;
232def err_unexpected_nested_namespace_attribute : Error<
233  "attributes cannot be specified on a nested namespace definition">;
234def err_inline_namespace_alias : Error<"namespace alias cannot be inline">;
235def err_namespace_nonnamespace_scope : Error<
236  "namespaces can only be defined in global or namespace scope">;
237def ext_nested_namespace_definition : ExtWarn<
238  "nested namespace definition is a C++17 extension; "
239  "define each namespace separately">, InGroup<CXX17>;
240def warn_cxx14_compat_nested_namespace_definition : Warning<
241  "nested namespace definition is incompatible with C++ standards before C++17">,
242  InGroup<CXXPre17Compat>, DefaultIgnore;
243def ext_inline_nested_namespace_definition : ExtWarn<
244  "inline nested namespace definition is a C++20 extension">, InGroup<CXX20>;
245def warn_cxx17_compat_inline_nested_namespace_definition : Warning<
246  "inline nested namespace definition is incompatible with C++ standards before"
247  " C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
248def err_inline_nested_namespace_definition : Error<
249  "nested namespace definition cannot be 'inline'">;
250def err_expected_semi_after_attribute_list : Error<
251  "expected ';' after attribute list">;
252def err_expected_semi_after_static_assert : Error<
253  "expected ';' after static_assert">;
254def err_expected_semi_for : Error<"expected ';' in 'for' statement specifier">;
255def err_single_decl_assign_in_for_range : Error<
256  "range-based 'for' statement uses ':', not '='">;
257def warn_missing_selector_name : Warning<
258  "%0 used as the name of the previous parameter rather than as part "
259  "of the selector">,
260  InGroup<DiagGroup<"missing-selector-name">>;
261def note_missing_selector_name : Note<
262  "introduce a parameter name to make %0 part of the selector">;
263def note_force_empty_selector_name : Note<
264  "or insert whitespace before ':' to use %0 as parameter name "
265  "and have an empty entry in the selector">;
266def err_label_end_of_compound_statement : Error<
267  "label at end of compound statement: expected statement">;
268def err_address_of_label_outside_fn : Error<
269  "use of address-of-label extension outside of a function body">;
270def err_asm_operand_wide_string_literal : Error<
271  "cannot use %select{unicode|wide|an empty}0 string literal in 'asm'">;
272def err_expected_selector_for_method : Error<
273  "expected selector for Objective-C method">;
274def err_expected_property_name : Error<"expected property name">;
275
276def err_unexpected_at : Error<"unexpected '@' in program">;
277def err_atimport : Error<
278"use of '@import' when modules are disabled">;
279
280def warn_atimport_in_framework_header : Warning<
281  "use of '@import' in framework header is discouraged, "
282  "including this header requires -fmodules">,
283  InGroup<FrameworkHdrAtImport>;
284
285def err_invalid_reference_qualifier_application : Error<
286  "'%0' qualifier may not be applied to a reference">;
287def err_illegal_decl_reference_to_reference : Error<
288  "%0 declared as a reference to a reference">;
289def ext_rvalue_reference : ExtWarn<
290  "rvalue references are a C++11 extension">, InGroup<CXX11>;
291def warn_cxx98_compat_rvalue_reference : Warning<
292  "rvalue references are incompatible with C++98">,
293  InGroup<CXX98Compat>, DefaultIgnore;
294def ext_ref_qualifier : ExtWarn<
295  "reference qualifiers on functions are a C++11 extension">, InGroup<CXX11>;
296def warn_cxx98_compat_ref_qualifier : Warning<
297  "reference qualifiers on functions are incompatible with C++98">,
298  InGroup<CXX98Compat>, DefaultIgnore;
299def ext_inline_namespace : ExtWarn<
300  "inline namespaces are a C++11 feature">, InGroup<CXX11InlineNamespace>;
301def warn_cxx98_compat_inline_namespace : Warning<
302  "inline namespaces are incompatible with C++98">,
303  InGroup<CXX98Compat>, DefaultIgnore;
304def ext_generalized_initializer_lists : ExtWarn<
305  "generalized initializer lists are a C++11 extension">,
306  InGroup<CXX11>;
307def warn_cxx98_compat_generalized_initializer_lists : Warning<
308  "generalized initializer lists are incompatible with C++98">,
309  InGroup<CXX98Compat>, DefaultIgnore;
310def err_init_list_bin_op : Error<"initializer list cannot be used on the "
311  "%select{left|right}0 hand side of operator '%1'">;
312def warn_cxx98_compat_trailing_return_type : Warning<
313  "trailing return types are incompatible with C++98">,
314  InGroup<CXX98Compat>, DefaultIgnore;
315def err_requires_clause_must_appear_after_trailing_return : Error<
316  "trailing return type must appear before trailing requires clause">;
317def err_requires_clause_on_declarator_not_declaring_a_function : Error<
318  "trailing requires clause can only be used when declaring a function">;
319def err_requires_clause_inside_parens : Error<
320  "trailing requires clause should be placed outside parentheses">;
321def ext_auto_storage_class : ExtWarn<
322  "'auto' storage class specifier is not permitted in C++11, and will not "
323  "be supported in future releases">, InGroup<DiagGroup<"auto-storage-class">>;
324def ext_decltype_auto_type_specifier : ExtWarn<
325  "'decltype(auto)' type specifier is a C++14 extension">, InGroup<CXX14>;
326def warn_cxx11_compat_decltype_auto_type_specifier : Warning<
327  "'decltype(auto)' type specifier is incompatible with C++ standards before "
328  "C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
329def ext_auto_type : Extension<
330  "'__auto_type' is a GNU extension">,
331  InGroup<GNUAutoType>;
332def ext_for_range : ExtWarn<
333  "range-based for loop is a C++11 extension">, InGroup<CXX11>;
334def warn_cxx98_compat_for_range : Warning<
335  "range-based for loop is incompatible with C++98">,
336  InGroup<CXX98Compat>, DefaultIgnore;
337def err_for_range_identifier : Error<
338  "range-based for loop requires type for loop variable">;
339def err_for_range_expected_decl : Error<
340  "for range declaration must declare a variable">;
341def err_argument_required_after_attribute : Error<
342  "argument required after attribute">;
343def err_missing_param : Error<"expected parameter declarator">;
344def err_function_scope_depth_exceeded : Error<
345  "function scope depth exceeded maximum of %0">, DefaultFatal;
346def err_missing_comma_before_ellipsis : Error<
347  "C requires a comma prior to the ellipsis in a variadic function type">;
348def err_unexpected_typedef_ident : Error<
349  "unexpected type name %0: expected identifier">;
350def warn_cxx98_compat_decltype : Warning<
351  "'decltype' type specifier is incompatible with C++98">,
352  InGroup<CXX98Compat>, DefaultIgnore;
353def err_unexpected_scope_on_base_decltype : Error<
354  "unexpected namespace scope prior to decltype">;
355def err_expected_class_name : Error<"expected class name">;
356def err_expected_class_name_not_template :
357  Error<"'typename' is redundant; base classes are implicitly types">;
358def err_unspecified_vla_size_with_static : Error<
359  "'static' may not be used with an unspecified variable length array size">;
360def err_unspecified_size_with_static : Error<
361  "'static' may not be used without an array size">;
362def err_expected_parentheses_around_typename : Error<
363  "expected parentheses around type name in %0 expression">;
364
365def err_expected_case_before_expression: Error<
366  "expected 'case' keyword before expression">;
367
368def ext_warn_gnu_final : ExtWarn<
369  "__final is a GNU extension, consider using C++11 final">,
370  InGroup<GccCompat>;
371
372// Declarations.
373def err_typename_requires_specqual : Error<
374  "type name requires a specifier or qualifier">;
375def err_typename_invalid_storageclass : Error<
376  "type name does not allow storage class to be specified">;
377def err_typename_invalid_functionspec : Error<
378  "type name does not allow function specifier to be specified">;
379def err_typename_invalid_constexpr : Error<
380  "type name does not allow %sub{select_constexpr_spec_kind}0 specifier "
381  "to be specified">;
382def err_typename_identifiers_only : Error<
383  "typename is allowed for identifiers only">;
384
385def err_friend_invalid_in_context : Error<
386  "'friend' used outside of class">;
387def err_templated_using_directive_declaration : Error<
388  "cannot template a using %select{directive|declaration}0">;
389def err_unexpected_colon_in_nested_name_spec : Error<
390  "unexpected ':' in nested name specifier; did you mean '::'?">;
391def err_unexpected_token_in_nested_name_spec : Error<
392  "'%0' cannot be a part of nested name specifier; did you mean ':'?">;
393def err_bool_redeclaration : Error<
394  "redeclaration of C++ built-in type 'bool'">;
395def warn_cxx98_compat_static_assert : Warning<
396  "static_assert declarations are incompatible with C++98">,
397  InGroup<CXX98Compat>, DefaultIgnore;
398def ext_static_assert_no_message : ExtWarn<
399  "static_assert with no message is a C++17 extension">, InGroup<CXX17>;
400def warn_cxx14_compat_static_assert_no_message : Warning<
401  "static_assert with no message is incompatible with C++ standards before "
402  "C++17">,
403  DefaultIgnore, InGroup<CXXPre17Compat>;
404def err_function_definition_not_allowed : Error<
405  "function definition is not allowed here">;
406def err_expected_end_of_enumerator : Error<
407  "expected '= constant-expression' or end of enumerator definition">;
408def err_expected_coloncolon_after_super : Error<
409  "expected '::' after '__super'">;
410
411def ext_decomp_decl_empty : ExtWarn<
412  "ISO C++17 does not allow a decomposition group to be empty">,
413  InGroup<DiagGroup<"empty-decomposition">>;
414
415/// Objective-C parser diagnostics
416def err_expected_minus_or_plus : Error<
417  "method type specifier must start with '-' or '+'">;
418def err_objc_missing_end : Error<"missing '@end'">;
419def note_objc_container_start : Note<
420  "%select{class|protocol|category|class extension|implementation"
421  "|category implementation}0 started here">;
422def warn_objc_protocol_qualifier_missing_id : Warning<
423  "protocol has no object type specified; defaults to qualified 'id'">;
424def err_objc_unknown_at : Error<"expected an Objective-C directive after '@'">;
425def err_illegal_super_cast : Error<
426  "cannot cast 'super' (it isn't an expression)">;
427def err_nsnumber_nonliteral_unary : Error<
428  "@%0 must be followed by a number to form an NSNumber object">;
429def warn_cstyle_param : Warning<
430  "use of C-style parameters in Objective-C method declarations"
431  " is deprecated">, InGroup<DeprecatedDeclarations>;
432
433let CategoryName = "ARC Parse Issue" in {
434def err_arc_bridge_retain : Error<
435  "unknown cast annotation __bridge_retain; did you mean __bridge_retained?">;
436// To be default mapped to an error later.
437def warn_arc_bridge_cast_nonarc : Warning<
438  "'%0' casts have no effect when not using ARC">,
439  InGroup<DiagGroup<"arc-bridge-casts-disallowed-in-nonarc">>;
440}
441
442def err_objc_illegal_visibility_spec : Error<
443  "illegal visibility specification">;
444def err_objc_illegal_interface_qual : Error<"illegal interface qualifier">;
445def err_objc_expected_equal_for_getter : Error<
446  "expected '=' for Objective-C getter">;
447def err_objc_expected_equal_for_setter : Error<
448  "expected '=' for Objective-C setter">;
449def err_objc_expected_selector_for_getter_setter : Error<
450  "expected selector for Objective-C %select{setter|getter}0">;
451def err_objc_property_requires_field_name : Error<
452  "property requires fields to be named">;
453def err_objc_property_bitfield : Error<"property name cannot be a bit-field">;
454def err_objc_expected_property_attr : Error<"unknown property attribute %0">;
455def err_objc_unexpected_attr : Error<
456  "prefix attribute must be followed by an interface, protocol, or implementation">;
457def err_objc_postfix_attribute : Error <
458  "postfix attributes are not allowed on Objective-C directives">;
459def err_objc_postfix_attribute_hint : Error <
460  "postfix attributes are not allowed on Objective-C directives, place"
461  " them in front of '%select{@interface|@protocol}0'">;
462def err_objc_directive_only_in_protocol : Error<
463  "directive may only be specified in protocols only">;
464def err_missing_catch_finally : Error<
465  "@try statement without a @catch and @finally clause">;
466def err_objc_concat_string : Error<"unexpected token after Objective-C string">;
467def err_expected_objc_container : Error<
468  "'@end' must appear in an Objective-C context">;
469def err_unexpected_protocol_qualifier : Error<
470  "@implementation declaration cannot be protocol qualified">;
471def err_objc_unexpected_atend : Error<
472  "'@end' appears where closing brace '}' is expected">;
473def err_synthesized_property_name : Error<
474  "expected a property name in @synthesize">;
475def warn_semicolon_before_method_body : Warning<
476  "semicolon before method body is ignored">,
477  InGroup<SemiBeforeMethodBody>, DefaultIgnore;
478def note_extra_comma_message_arg : Note<
479  "comma separating Objective-C messaging arguments">;
480
481def err_expected_field_designator : Error<
482  "expected a field designator, such as '.field = 4'">;
483
484def err_declaration_does_not_declare_param : Error<
485  "declaration does not declare a parameter">;
486def err_no_matching_param : Error<"parameter named %0 is missing">;
487
488/// Objective-C++ parser diagnostics
489def err_expected_token_instead_of_objcxx_keyword : Error<
490  "expected %0; %1 is a keyword in Objective-C++">;
491def err_expected_member_name_or_semi_objcxx_keyword : Error<
492  "expected member name or ';' after declaration specifiers; "
493  "%0 is a keyword in Objective-C++">;
494
495/// C++ parser diagnostics
496def err_invalid_operator_on_type : Error<
497  "cannot use %select{dot|arrow}0 operator on a type">;
498def err_expected_unqualified_id : Error<
499  "expected %select{identifier|unqualified-id}0">;
500def err_brackets_go_after_unqualified_id : Error<
501  "brackets are not allowed here; to declare an array, "
502  "place the brackets after the %select{identifier|name}0">;
503def err_unexpected_unqualified_id : Error<"type-id cannot have a name">;
504def err_func_def_no_params : Error<
505  "function definition does not declare parameters">;
506def err_expected_lparen_after_type : Error<
507  "expected '(' for function-style cast or type construction">;
508def err_expected_init_in_condition : Error<
509  "variable declaration in condition must have an initializer">;
510def err_expected_init_in_condition_lparen : Error<
511  "variable declaration in condition cannot have a parenthesized initializer">;
512def err_extraneous_rparen_in_condition : Error<
513  "extraneous ')' after condition, expected a statement">;
514def warn_dangling_else : Warning<
515  "add explicit braces to avoid dangling else">,
516  InGroup<DanglingElse>;
517def err_expected_member_or_base_name : Error<
518  "expected class member or base class name">;
519def err_expected_lbrace_after_base_specifiers : Error<
520  "expected '{' after base class list">;
521def err_missing_end_of_definition : Error<
522  "missing '}' at end of definition of %q0">;
523def note_missing_end_of_definition_before : Note<
524  "still within definition of %q0 here">;
525def ext_ellipsis_exception_spec : Extension<
526  "exception specification of '...' is a Microsoft extension">,
527  InGroup<MicrosoftExceptionSpec>;
528def err_dynamic_and_noexcept_specification : Error<
529  "cannot have both throw() and noexcept() clause on the same function">;
530def err_except_spec_unparsed : Error<
531  "unexpected end of exception specification">;
532def ext_dynamic_exception_spec : ExtWarn<
533  "ISO C++17 does not allow dynamic exception specifications">,
534  InGroup<DynamicExceptionSpec>, DefaultError;
535def warn_exception_spec_deprecated : Warning<
536  "dynamic exception specifications are deprecated">,
537  InGroup<DeprecatedDynamicExceptionSpec>, DefaultIgnore;
538def note_exception_spec_deprecated : Note<"use '%0' instead">;
539def warn_cxx98_compat_noexcept_decl : Warning<
540  "noexcept specifications are incompatible with C++98">,
541  InGroup<CXX98Compat>, DefaultIgnore;
542def err_expected_catch : Error<"expected catch">;
543def err_using_namespace_in_class : Error<
544  "'using namespace' is not allowed in classes">;
545def err_constructor_bad_name : Error<
546  "missing return type for function %0; did you mean the constructor name %1?">;
547def err_destructor_tilde_identifier : Error<
548  "expected a class name after '~' to name a destructor">;
549def err_destructor_tilde_scope : Error<
550  "'~' in destructor name should be after nested name specifier">;
551def err_destructor_template_id : Error<
552  "destructor name %0 does not refer to a template">;
553def err_default_arg_unparsed : Error<
554  "unexpected end of default argument expression">;
555def err_bracket_depth_exceeded : Error<
556  "bracket nesting level exceeded maximum of %0">, DefaultFatal;
557def note_bracket_depth : Note<
558  "use -fbracket-depth=N to increase maximum nesting level">;
559def err_misplaced_ellipsis_in_declaration : Error<
560  "'...' must %select{immediately precede declared identifier|"
561  "be innermost component of anonymous pack declaration}0">;
562def warn_misplaced_ellipsis_vararg : Warning<
563  "'...' in this location creates a C-style varargs function"
564  "%select{, not a function parameter pack|}0">,
565  InGroup<DiagGroup<"ambiguous-ellipsis">>;
566def note_misplaced_ellipsis_vararg_existing_ellipsis : Note<
567  "preceding '...' declares a function parameter pack">;
568def note_misplaced_ellipsis_vararg_add_ellipsis : Note<
569  "place '...' %select{immediately before declared identifier|here}0 "
570  "to declare a function parameter pack">;
571def note_misplaced_ellipsis_vararg_add_comma : Note<
572  "insert ',' before '...' to silence this warning">;
573def ext_abstract_pack_declarator_parens : ExtWarn<
574  "ISO C++11 requires a parenthesized pack declaration to have a name">,
575  InGroup<DiagGroup<"anonymous-pack-parens">>;
576def err_function_is_not_record : Error<
577  "unexpected %0 in function call; perhaps remove the %0?">;
578def err_super_in_using_declaration : Error<
579  "'__super' cannot be used with a using declaration">;
580def ext_constexpr_if : ExtWarn<
581  "constexpr if is a C++17 extension">, InGroup<CXX17>;
582def warn_cxx14_compat_constexpr_if : Warning<
583  "constexpr if is incompatible with C++ standards before C++17">,
584  DefaultIgnore, InGroup<CXXPre17Compat>;
585def ext_init_statement : ExtWarn<
586  "'%select{if|switch}0' initialization statements are a C++17 extension">,
587  InGroup<CXX17>;
588def warn_cxx14_compat_init_statement : Warning<
589  "%select{if|switch}0 initialization statements are incompatible with "
590  "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
591def ext_for_range_init_stmt : ExtWarn<
592  "range-based for loop initialization statements are a C++20 extension">,
593  InGroup<CXX20>;
594def warn_cxx17_compat_for_range_init_stmt : Warning<
595  "range-based for loop initialization statements are incompatible with "
596  "C++ standards before C++20">, DefaultIgnore, InGroup<CXXPre20Compat>;
597def warn_empty_init_statement : Warning<
598  "empty initialization statement of '%select{if|switch|range-based for}0' "
599  "has no effect">, InGroup<EmptyInitStatement>, DefaultIgnore;
600
601// C++ derived classes
602def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">;
603
604// C++ operator overloading
605def err_literal_operator_string_prefix : Error<
606  "string literal after 'operator' cannot have an encoding prefix">;
607def err_literal_operator_string_not_empty : Error<
608  "string literal after 'operator' must be '\"\"'">;
609def warn_cxx98_compat_literal_operator : Warning<
610  "literal operators are incompatible with C++98">,
611  InGroup<CXX98Compat>, DefaultIgnore;
612
613// Classes.
614def err_anon_type_definition : Error<
615  "declaration of anonymous %0 must be a definition">;
616def err_default_delete_in_multiple_declaration : Error<
617  "'= %select{default|delete}0' is a function definition and must occur in a "
618  "standalone declaration">;
619
620def warn_cxx98_compat_noexcept_expr : Warning<
621  "noexcept expressions are incompatible with C++98">,
622  InGroup<CXX98Compat>, DefaultIgnore;
623def warn_cxx98_compat_nullptr : Warning<
624  "'nullptr' is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
625
626def warn_wrong_clang_attr_namespace : Warning<
627  "'__clang__' is a predefined macro name, not an attribute scope specifier; "
628  "did you mean '_Clang' instead?">, InGroup<IgnoredAttributes>;
629def ext_ns_enum_attribute : Extension<
630  "attributes on %select{a namespace|an enumerator}0 declaration are "
631  "a C++17 extension">, InGroup<CXX17>;
632def warn_cxx14_compat_ns_enum_attribute : Warning<
633  "attributes on %select{a namespace|an enumerator}0 declaration are "
634  "incompatible with C++ standards before C++17">,
635  InGroup<CXXPre17CompatPedantic>, DefaultIgnore;
636def warn_cxx98_compat_alignas : Warning<"'alignas' is incompatible with C++98">,
637  InGroup<CXX98Compat>, DefaultIgnore;
638def warn_cxx98_compat_attribute : Warning<
639  "C++11 attribute syntax is incompatible with C++98">,
640  InGroup<CXX98Compat>, DefaultIgnore;
641def err_cxx11_attribute_forbids_arguments : Error<
642  "attribute %0 cannot have an argument list">;
643def err_attribute_requires_arguments : Error<
644  "parentheses must be omitted if %0 attribute's argument list is empty">;
645def err_cxx11_attribute_forbids_ellipsis : Error<
646  "attribute %0 cannot be used as an attribute pack">;
647def err_cxx11_attribute_repeated : Error<
648  "attribute %0 cannot appear multiple times in an attribute specifier">;
649def warn_cxx14_compat_using_attribute_ns : Warning<
650  "default scope specifier for attributes is incompatible with C++ standards "
651  "before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
652def ext_using_attribute_ns : ExtWarn<
653  "default scope specifier for attributes is a C++17 extension">,
654  InGroup<CXX17>;
655def err_using_attribute_ns_conflict : Error<
656  "attribute with scope specifier cannot follow default scope specifier">;
657def err_attributes_not_allowed : Error<"an attribute list cannot appear here">;
658def err_attributes_misplaced : Error<"misplaced attributes; expected attributes here">;
659def err_l_square_l_square_not_attribute : Error<
660  "C++11 only allows consecutive left square brackets when "
661  "introducing an attribute">;
662def err_ms_declspec_type : Error<
663  "__declspec attributes must be an identifier or string literal">;
664def err_ms_property_no_getter_or_putter : Error<
665  "property does not specify a getter or a putter">;
666def err_ms_property_unknown_accessor : Error<
667  "expected 'get' or 'put' in property declaration">;
668def err_ms_property_has_set_accessor : Error<
669  "putter for property must be specified as 'put', not 'set'">;
670def err_ms_property_missing_accessor_kind : Error<
671  "missing 'get=' or 'put='">;
672def err_ms_property_expected_equal : Error<
673  "expected '=' after '%0'">;
674def err_ms_property_duplicate_accessor : Error<
675  "property declaration specifies '%0' accessor twice">;
676def err_ms_property_expected_accessor_name : Error<
677  "expected name of accessor method">;
678def err_ms_property_expected_comma_or_rparen : Error<
679  "expected ',' or ')' at end of property accessor list">;
680def err_ms_property_initializer : Error<
681  "property declaration cannot have an in-class initializer">;
682
683def warn_cxx2a_compat_explicit_bool : Warning<
684  "this expression will be parsed as explicit(bool) in C++20">,
685  InGroup<CXX20Compat>, DefaultIgnore;
686def warn_cxx17_compat_explicit_bool : Warning<
687  "explicit(bool) is incompatible with C++ standards before C++20">,
688  InGroup<CXXPre20Compat>, DefaultIgnore;
689def ext_explicit_bool : ExtWarn<"explicit(bool) is a C++20 extension">,
690  InGroup<CXX20>;
691
692/// C++ Templates
693def err_expected_template : Error<"expected template">;
694def err_unknown_template_name : Error<
695  "unknown template name %0">;
696def err_expected_comma_greater : Error<
697  "expected ',' or '>' in template-parameter-list">;
698def err_class_on_template_template_param : Error<
699  "template template parameter requires 'class' after the parameter list">;
700def ext_template_template_param_typename : ExtWarn<
701  "template template parameter using 'typename' is a C++17 extension">,
702  InGroup<CXX17>;
703def warn_cxx14_compat_template_template_param_typename : Warning<
704  "template template parameter using 'typename' is "
705  "incompatible with C++ standards before C++17">,
706  InGroup<CXXPre17Compat>, DefaultIgnore;
707def err_template_spec_syntax_non_template : Error<
708  "identifier followed by '<' indicates a class template specialization but "
709  "%0 %select{does not refer to a template|refers to a function template|"
710  "<unused>|refers to a variable template|<unused>|refers to a concept}1">;
711def err_id_after_template_in_nested_name_spec : Error<
712  "expected template name after 'template' keyword in nested name specifier">;
713def err_unexpected_template_in_unqualified_id : Error<
714  "'template' keyword not permitted here">;
715def err_unexpected_template_after_using : Error<
716  "'template' keyword not permitted after 'using' keyword">;
717def err_two_right_angle_brackets_need_space : Error<
718  "a space is required between consecutive right angle brackets (use '> >')">;
719def err_right_angle_bracket_equal_needs_space : Error<
720  "a space is required between a right angle bracket and an equals sign "
721  "(use '> =')">;
722def warn_cxx11_right_shift_in_template_arg : Warning<
723  "use of right-shift operator ('>>') in template argument will require "
724  "parentheses in C++11">, InGroup<CXX11Compat>;
725def warn_cxx98_compat_two_right_angle_brackets : Warning<
726  "consecutive right angle brackets are incompatible with C++98 (use '> >')">,
727  InGroup<CXX98Compat>, DefaultIgnore;
728def err_templated_invalid_declaration : Error<
729  "a static_assert declaration cannot be a template">;
730def err_multiple_template_declarators : Error<
731  "%select{|a template declaration|an explicit template specialization|"
732  "an explicit template instantiation}0 can "
733  "only %select{|declare|declare|instantiate}0 a single entity">;
734def err_explicit_instantiation_with_definition : Error<
735  "explicit template instantiation cannot have a definition; if this "
736  "definition is meant to be an explicit specialization, add '<>' after the "
737  "'template' keyword">;
738def err_template_defn_explicit_instantiation : Error<
739  "%select{function|class|variable}0 cannot be defined in an explicit instantiation; if this "
740  "declaration is meant to be a %select{function|class|variable}0 definition, remove the 'template' keyword">;
741def err_friend_explicit_instantiation : Error<
742  "friend cannot be declared in an explicit instantiation; if this "
743  "declaration is meant to be a friend declaration, remove the 'template' keyword">;
744def err_explicit_instantiation_enum : Error<
745  "enumerations cannot be explicitly instantiated">;
746def err_expected_template_parameter : Error<"expected template parameter">;
747def note_ill_formed_requires_expression_outside_template : Note<
748  "requires expression outside a template declaration may not contain invalid "
749  "types or expressions">;
750def err_empty_requires_expr : Error<
751  "a requires expression must contain at least one requirement">;
752def err_requires_expr_parameter_list_ellipsis : Error<
753  "varargs not allowed in requires expression">;
754def err_requires_expr_type_req_illegal_identifier : Error<
755  "expected identifier or template-id in type requirement">;
756def err_requires_expr_type_req_template_args_on_non_template : Error<
757  "template arguments provided for non-template '%0'">;
758def err_expected_semi_requirement : Error<
759  "expected ';' at end of requirement">;
760def err_requires_expr_missing_arrow : Error<
761  "expected '->' before expression type requirement">;
762def err_requires_expr_expected_type_constraint : Error<
763  "expected concept name with optional arguments">;
764def err_requires_expr_simple_requirement_noexcept : Error<
765  "'noexcept' can only be used in a compound requirement (with '{' '}' around "
766  "the expression)">;
767def err_requires_expr_simple_requirement_unexpected_tok : Error<
768  "unexpected %0 after expression; did you intend to use a compound "
769  "requirement (with '{' '}' around the expression)?">;
770def warn_requires_expr_in_simple_requirement : Warning<
771  "this requires expression will only be checked for syntactic validity; did "
772  "you intend to place it in a nested requirement? (add another 'requires' "
773  "before the expression)">, InGroup<DiagGroup<"requires-expression">>;
774
775def err_missing_dependent_template_keyword : Error<
776  "use 'template' keyword to treat '%0' as a dependent template name">;
777def warn_missing_dependent_template_keyword : ExtWarn<
778  "use 'template' keyword to treat '%0' as a dependent template name">;
779
780def ext_extern_template : Extension<
781  "extern templates are a C++11 extension">, InGroup<CXX11>;
782def warn_cxx98_compat_extern_template : Warning<
783  "extern templates are incompatible with C++98">,
784  InGroup<CXX98CompatPedantic>, DefaultIgnore;
785def warn_static_inline_explicit_inst_ignored : Warning<
786  "ignoring '%select{static|inline}0' keyword on explicit template "
787  "instantiation">, InGroup<DiagGroup<"static-inline-explicit-instantiation">>;
788
789// Constructor template diagnostics.
790def err_out_of_line_constructor_template_id : Error<
791  "out-of-line constructor for %0 cannot have template arguments">;
792
793def err_expected_qualified_after_typename : Error<
794  "expected a qualified name after 'typename'">;
795def warn_expected_qualified_after_typename : ExtWarn<
796  "expected a qualified name after 'typename'">;
797
798def err_typename_refers_to_non_type_template : Error<
799  "typename specifier refers to a non-type template">;
800def err_expected_type_name_after_typename : Error<
801  "expected an identifier or template-id after '::'">;
802def err_explicit_spec_non_template : Error<
803  "explicit %select{specialization|instantiation}0 of "
804  "%select{non-|undeclared }3template %1 %2">;
805
806def err_default_template_template_parameter_not_template : Error<
807  "default template argument for a template template parameter must be a class "
808  "template">;
809
810def ext_fold_expression : ExtWarn<
811  "pack fold expression is a C++17 extension">,
812  InGroup<CXX17>;
813def warn_cxx14_compat_fold_expression : Warning<
814  "pack fold expression is incompatible with C++ standards before C++17">,
815  InGroup<CXXPre17Compat>, DefaultIgnore;
816def err_expected_fold_operator : Error<
817  "expected a foldable binary operator in fold expression">;
818def err_fold_operator_mismatch : Error<
819  "operators in fold expression must be the same">;
820
821def err_ctor_init_missing_comma : Error<
822  "missing ',' between base or member initializers">;
823
824// C++ declarations
825def err_friend_decl_defines_type : Error<
826  "cannot define a type in a friend declaration">;
827def err_missing_whitespace_digraph : Error<
828  "found '<::' after a "
829  "%select{template name|const_cast|dynamic_cast|reinterpret_cast|static_cast}0"
830  " which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?">;
831
832def ext_defaulted_deleted_function : ExtWarn<
833  "%select{defaulted|deleted}0 function definitions are a C++11 extension">,
834  InGroup<CXX11>;
835def warn_cxx98_compat_defaulted_deleted_function : Warning<
836  "%select{defaulted|deleted}0 function definitions are incompatible with C++98">,
837  InGroup<CXX98Compat>, DefaultIgnore;
838
839// C++11 in-class member initialization
840def ext_nonstatic_member_init : ExtWarn<
841  "in-class initialization of non-static data member is a C++11 extension">,
842  InGroup<CXX11>;
843def warn_cxx98_compat_nonstatic_member_init : Warning<
844  "in-class initialization of non-static data members is incompatible with C++98">,
845  InGroup<CXX98Compat>, DefaultIgnore;
846def ext_bitfield_member_init: ExtWarn<
847  "default member initializer for bit-field is a C++20 extension">,
848  InGroup<CXX20>;
849def warn_cxx17_compat_bitfield_member_init: Warning<
850  "default member initializer for bit-field is incompatible with "
851  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
852def err_incomplete_array_member_init: Error<
853  "array bound cannot be deduced from an in-class initializer">;
854
855// C++11 alias-declaration
856def ext_alias_declaration : ExtWarn<
857  "alias declarations are a C++11 extension">, InGroup<CXX11>;
858def warn_cxx98_compat_alias_declaration : Warning<
859  "alias declarations are incompatible with C++98">,
860  InGroup<CXX98Compat>, DefaultIgnore;
861def err_alias_declaration_not_identifier : Error<
862  "name defined in alias declaration must be an identifier">;
863def err_alias_declaration_specialization : Error<
864  "%select{partial specialization|explicit specialization|explicit instantiation}0 of alias templates is not permitted">;
865def err_alias_declaration_pack_expansion : Error<
866  "alias declaration cannot be a pack expansion">;
867
868// C++17 using-declaration pack expansions
869def ext_multi_using_declaration : ExtWarn<
870  "use of multiple declarators in a single using declaration is "
871  "a C++17 extension">, InGroup<CXX17>;
872def warn_cxx17_compat_multi_using_declaration : Warning<
873  "use of multiple declarators in a single using declaration is "
874  "incompatible with C++ standards before C++17">,
875  InGroup<CXXPre17Compat>, DefaultIgnore;
876def ext_using_declaration_pack : ExtWarn<
877  "pack expansion of using declaration is a C++17 extension">, InGroup<CXX17>;
878def warn_cxx17_compat_using_declaration_pack : Warning<
879  "pack expansion using declaration is incompatible with C++ standards "
880  "before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
881
882// C++11 override control
883def ext_override_control_keyword : ExtWarn<
884  "'%0' keyword is a C++11 extension">, InGroup<CXX11>;
885def warn_cxx98_compat_override_control_keyword : Warning<
886  "'%0' keyword is incompatible with C++98">,
887  InGroup<CXX98Compat>, DefaultIgnore;
888def err_override_control_interface : Error<
889  "'%0' keyword not permitted with interface types">;
890def ext_ms_sealed_keyword : ExtWarn<
891  "'sealed' keyword is a Microsoft extension">,
892  InGroup<MicrosoftSealed>;
893
894def err_access_specifier_interface : Error<
895  "interface types cannot specify '%select{private|protected}0' access">;
896
897def err_duplicate_virt_specifier : Error<
898  "class member already marked '%0'">;
899
900def err_scoped_enum_missing_identifier : Error<
901  "scoped enumeration requires a name">;
902def ext_scoped_enum : ExtWarn<
903  "scoped enumerations are a C++11 extension">, InGroup<CXX11>;
904def warn_cxx98_compat_scoped_enum : Warning<
905  "scoped enumerations are incompatible with C++98">,
906  InGroup<CXX98Compat>, DefaultIgnore;
907
908def err_expected_parameter_pack : Error<
909  "expected the name of a parameter pack">;
910def err_paren_sizeof_parameter_pack : Error<
911  "missing parentheses around the size of parameter pack %0">;
912def err_sizeof_parameter_pack : Error<
913  "expected parenthesized parameter pack name in 'sizeof...' expression">;
914
915// C++11 lambda expressions
916def err_expected_comma_or_rsquare : Error<
917  "expected ',' or ']' in lambda capture list">;
918def err_this_captured_by_reference : Error<
919  "'this' cannot be captured by reference">;
920def err_expected_capture : Error<
921  "expected variable name or 'this' in lambda capture list">;
922def err_expected_lambda_body : Error<"expected body of lambda expression">;
923def warn_cxx98_compat_lambda : Warning<
924  "lambda expressions are incompatible with C++98">,
925  InGroup<CXX98Compat>, DefaultIgnore;
926def err_lambda_missing_parens : Error<
927  "lambda requires '()' before %select{'mutable'|return type|"
928  "attribute specifier|'constexpr'|'consteval'|'requires' clause}0">;
929def err_lambda_decl_specifier_repeated : Error<
930  "%select{'mutable'|'constexpr'|'consteval'}0 cannot appear multiple times in a lambda declarator">;
931def err_lambda_capture_misplaced_ellipsis : Error<
932  "ellipsis in pack %select{|init-}0capture must appear %select{after|before}0 "
933  "the name of the capture">;
934def err_lambda_capture_multiple_ellipses : Error<
935  "multiple ellipses in pack capture">;
936// C++17 lambda expressions
937def err_expected_star_this_capture : Error<
938  "expected 'this' following '*' in lambda capture list">;
939
940// C++17 constexpr lambda expressions
941def warn_cxx14_compat_constexpr_on_lambda : Warning<
942  "constexpr on lambda expressions is incompatible with C++ standards before C++17">,
943  InGroup<CXXPre17Compat>, DefaultIgnore;
944def ext_constexpr_on_lambda_cxx17 : ExtWarn<
945  "'constexpr' on lambda expressions is a C++17 extension">, InGroup<CXX17>;
946
947// C++20 template lambdas
948def ext_lambda_template_parameter_list: ExtWarn<
949  "explicit template parameter list for lambdas is a C++20 extension">,
950  InGroup<CXX20>;
951def warn_cxx17_compat_lambda_template_parameter_list: Warning<
952  "explicit template parameter list for lambdas is incompatible with "
953  "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
954def err_lambda_template_parameter_list_empty : Error<
955  "lambda template parameter list cannot be empty">;
956
957// Availability attribute
958def err_expected_version : Error<
959  "expected a version of the form 'major[.minor[.subminor]]'">;
960def warn_expected_consistent_version_separator : Warning<
961  "use same version number separators '_' or '.'; as in "
962  "'major[.minor[.subminor]]'">, InGroup<Availability>;
963def err_zero_version : Error<
964  "version number must have non-zero major, minor, or sub-minor version">;
965def err_availability_expected_platform : Error<
966  "expected a platform name, e.g., 'macos'">;
967
968// objc_bridge_related attribute
969def err_objcbridge_related_expected_related_class : Error<
970  "expected a related ObjectiveC class name, e.g., 'NSColor'">;
971def err_objcbridge_related_selector_name : Error<
972  "expected a class method selector with single argument, e.g., 'colorWithCGColor:'">;
973
974def err_availability_expected_change : Error<
975  "expected 'introduced', 'deprecated', or 'obsoleted'">;
976def err_availability_unknown_change : Error<
977  "%0 is not an availability stage; use 'introduced', 'deprecated', or "
978  "'obsoleted'">;
979def err_availability_redundant : Error<
980  "redundant %0 availability change; only the last specified change will "
981  "be used">;
982def warn_availability_and_unavailable : Warning<
983  "'unavailable' availability overrides all other availability information">,
984  InGroup<Availability>;
985
986// @available(...)
987def err_avail_query_expected_platform_name : Error<
988  "expected a platform name here">;
989
990def err_avail_query_unrecognized_platform_name : Error<
991  "unrecognized platform name %0">;
992def err_availability_query_wildcard_required: Error<
993  "must handle potential future platforms with '*'">;
994def err_availability_query_repeated_platform: Error<
995  "version for '%0' already specified">;
996def err_availability_query_repeated_star : Error<
997  "'*' query has already been specified">;
998
999// External source symbol attribute
1000def err_external_source_symbol_expected_keyword : Error<
1001  "expected 'language', 'defined_in', or 'generated_declaration'">;
1002def err_external_source_symbol_duplicate_clause : Error<
1003  "duplicate %0 clause in an 'external_source_symbol' attribute">;
1004
1005// Type safety attributes
1006def err_type_safety_unknown_flag : Error<
1007  "invalid comparison flag %0; use 'layout_compatible' or 'must_be_null'">;
1008
1009// Type traits
1010def err_type_trait_arity : Error<
1011  "type trait requires %0%select{| or more}1 argument%select{|s}2; have "
1012  "%3 argument%s3">;
1013
1014// Language specific pragmas
1015// - Generic warnings
1016def warn_pragma_expected_lparen : Warning<
1017  "missing '(' after '#pragma %0' - ignoring">, InGroup<IgnoredPragmas>;
1018def warn_pragma_expected_rparen : Warning<
1019  "missing ')' after '#pragma %0' - ignoring">, InGroup<IgnoredPragmas>;
1020def warn_pragma_expected_identifier : Warning<
1021  "expected identifier in '#pragma %0' - ignored">, InGroup<IgnoredPragmas>;
1022def warn_pragma_expected_string : Warning<
1023  "expected string literal in '#pragma %0' - ignoring">, InGroup<IgnoredPragmas>;
1024def warn_pragma_missing_argument : Warning<
1025  "missing argument to '#pragma %0'%select{|; expected %2}1">, InGroup<IgnoredPragmas>;
1026def warn_pragma_invalid_argument : Warning<
1027  "unexpected argument '%0' to '#pragma %1'%select{|; expected %3}2">, InGroup<IgnoredPragmas>;
1028
1029def err_pragma_misplaced_in_decl : Error<"this pragma cannot appear in %0 declaration">;
1030
1031// '#pragma clang section' related errors
1032def err_pragma_expected_clang_section_name : Error<
1033  "expected one of [bss|data|rodata|text|relro] section kind in '#pragma %0'">;
1034def err_pragma_clang_section_expected_equal : Error<
1035  "expected '=' following '#pragma clang section %select{invalid|bss|data|rodata|text|relro}0'">;
1036def warn_pragma_expected_section_name : Warning<
1037  "expected a string literal for the section name in '#pragma %0' - ignored">,
1038  InGroup<IgnoredPragmas>;
1039
1040def warn_pragma_expected_section_push_pop_or_name : Warning<
1041  "expected push, pop or a string literal for the section name in '#pragma %0' - ignored">,
1042  InGroup<IgnoredPragmas>;
1043def warn_pragma_expected_section_label_or_name : Warning<
1044  "expected a stack label or a string literal for the section name in '#pragma %0' - ignored">,
1045  InGroup<IgnoredPragmas>;
1046def warn_pragma_expected_init_seg : Warning<
1047  "expected 'compiler', 'lib', 'user', or a string literal for the section name in '#pragma %0' - ignored">,
1048  InGroup<IgnoredPragmas>;
1049def warn_pragma_expected_integer : Warning<
1050  "expected integer between %0 and %1 inclusive in '#pragma %2' - ignored">,
1051  InGroup<IgnoredPragmas>;
1052def warn_pragma_ms_struct : Warning<
1053  "incorrect use of '#pragma ms_struct on|off' - ignored">,
1054  InGroup<IgnoredPragmas>;
1055def warn_pragma_extra_tokens_at_eol : Warning<
1056  "extra tokens at end of '#pragma %0' - ignored">,
1057  InGroup<IgnoredPragmas>;
1058def warn_pragma_expected_comma : Warning<
1059  "expected ',' in '#pragma %0'">, InGroup<IgnoredPragmas>;
1060def warn_pragma_expected_punc : Warning<
1061  "expected ')' or ',' in '#pragma %0'">, InGroup<IgnoredPragmas>;
1062def warn_pragma_expected_non_wide_string : Warning<
1063  "expected non-wide string literal in '#pragma %0'">, InGroup<IgnoredPragmas>;
1064// - Generic errors
1065def err_pragma_missing_argument : Error<
1066  "missing argument to '#pragma %0'%select{|; expected %2}1">;
1067// - #pragma options
1068def warn_pragma_options_expected_align : Warning<
1069  "expected 'align' following '#pragma options' - ignored">,
1070  InGroup<IgnoredPragmas>;
1071def warn_pragma_align_expected_equal : Warning<
1072  "expected '=' following '#pragma %select{align|options align}0' - ignored">,
1073  InGroup<IgnoredPragmas>;
1074def warn_pragma_align_invalid_option : Warning<
1075  "invalid alignment option in '#pragma %select{align|options align}0' - ignored">,
1076  InGroup<IgnoredPragmas>;
1077// - #pragma pack
1078def warn_pragma_unsupported_action : Warning<
1079  "known but unsupported action '%1' for '#pragma %0' - ignored">,
1080  InGroup<IgnoredPragmas>;
1081def warn_pragma_invalid_specific_action : Warning<
1082  "unknown action '%1' for '#pragma %0' - ignored">,
1083  InGroup<IgnoredPragmas>;
1084def warn_pragma_expected_action_or_r_paren : Warning<
1085  "expected action or ')' in '#pragma %0' - ignored">,
1086  InGroup<IgnoredPragmas>;
1087def warn_pragma_invalid_action : Warning<
1088  "unknown action for '#pragma %0' - ignored">,
1089  InGroup<IgnoredPragmas>;
1090def warn_pragma_pack_malformed : Warning<
1091  "expected integer or identifier in '#pragma pack' - ignored">,
1092  InGroup<IgnoredPragmas>;
1093// - #pragma intrinsic
1094def warn_pragma_intrinsic_builtin : Warning<
1095  "%0 is not a recognized builtin%select{|; consider including <intrin.h> to access non-builtin intrinsics}1">,
1096  InGroup<IgnoredPragmaIntrinsic>;
1097// - #pragma optimize
1098def warn_pragma_optimize : Warning<
1099  "'#pragma optimize' is not supported">,
1100  InGroup<IgnoredPragmaOptimize>;
1101// - #pragma unused
1102def warn_pragma_unused_expected_var : Warning<
1103  "expected '#pragma unused' argument to be a variable name">,
1104  InGroup<IgnoredPragmas>;
1105// - #pragma init_seg
1106def warn_pragma_init_seg_unsupported_target : Warning<
1107  "'#pragma init_seg' is only supported when targeting a "
1108  "Microsoft environment">,
1109  InGroup<IgnoredPragmas>;
1110// - #pragma fp_contract
1111def err_pragma_fp_contract_scope : Error<
1112  "'#pragma fp_contract' can only appear at file scope or at the start of a "
1113  "compound statement">;
1114// - #pragma stdc unknown
1115def ext_stdc_pragma_ignored : ExtWarn<"unknown pragma in STDC namespace">,
1116   InGroup<UnknownPragmas>;
1117def warn_stdc_fenv_access_not_supported :
1118   Warning<"pragma STDC FENV_ACCESS ON is not supported, ignoring pragma">,
1119   InGroup<UnknownPragmas>;
1120// - #pragma comment
1121def err_pragma_comment_malformed : Error<
1122  "pragma comment requires parenthesized identifier and optional string">;
1123def err_pragma_comment_unknown_kind : Error<"unknown kind of pragma comment">;
1124// PS4 recognizes only #pragma comment(lib)
1125def warn_pragma_comment_ignored : Warning<"'#pragma comment %0' ignored">,
1126  InGroup<IgnoredPragmas>;
1127// - #pragma detect_mismatch
1128def err_pragma_detect_mismatch_malformed : Error<
1129  "pragma detect_mismatch is malformed; it requires two comma-separated "
1130  "string literals">;
1131// - #pragma pointers_to_members
1132def err_pragma_pointers_to_members_unknown_kind : Error<
1133  "unexpected %0, expected to see one of %select{|'best_case', 'full_generality', }1"
1134  "'single_inheritance', 'multiple_inheritance', or 'virtual_inheritance'">;
1135// - #pragma clang optimize on/off
1136def err_pragma_optimize_invalid_argument : Error<
1137  "unexpected argument '%0' to '#pragma clang optimize'; "
1138  "expected 'on' or 'off'">;
1139def err_pragma_optimize_extra_argument : Error<
1140  "unexpected extra argument '%0' to '#pragma clang optimize'">;
1141// - #pragma clang attribute
1142def err_pragma_attribute_expected_push_pop_paren : Error<
1143  "expected 'push', 'pop', or '(' after '#pragma clang attribute'">;
1144def err_pragma_attribute_invalid_argument : Error<
1145  "unexpected argument '%0' to '#pragma clang attribute'; "
1146  "expected 'push' or 'pop'">;
1147def err_pragma_attribute_expected_attribute : Error<
1148  "expected an attribute after '('">;
1149def err_pragma_attribute_expected_attribute_name : Error<
1150  "expected identifier that represents an attribute name">;
1151def err_pragma_attribute_extra_tokens_after_attribute : Error<
1152  "extra tokens after attribute in a '#pragma clang attribute push'">;
1153def err_pragma_attribute_unsupported_attribute : Error<
1154  "attribute %0 is not supported by '#pragma clang attribute'">;
1155def err_pragma_attribute_multiple_attributes : Error<
1156  "more than one attribute specified in '#pragma clang attribute push'">;
1157def err_pragma_attribute_expected_attribute_syntax : Error<
1158  "expected an attribute that is specified using the GNU, C++11 or '__declspec'"
1159  " syntax">;
1160def note_pragma_attribute_use_attribute_kw : Note<"use the GNU '__attribute__' "
1161  "syntax">;
1162def err_pragma_attribute_invalid_subject_set_specifier : Error<
1163  "expected attribute subject set specifier 'apply_to'">;
1164def err_pragma_attribute_expected_subject_identifier : Error<
1165  "expected an identifier that corresponds to an attribute subject rule">;
1166def err_pragma_attribute_unknown_subject_rule : Error<
1167  "unknown attribute subject rule '%0'">;
1168def err_pragma_attribute_expected_subject_sub_identifier : Error<
1169  "expected an identifier that corresponds to an attribute subject matcher "
1170  "sub-rule; '%0' matcher %select{does not support sub-rules|supports the "
1171  "following sub-rules: %2|}1">;
1172def err_pragma_attribute_unknown_subject_sub_rule : Error<
1173  "%select{invalid use of|unknown}2 attribute subject matcher sub-rule '%0'; "
1174  "'%1' matcher %select{does not support sub-rules|supports the following "
1175  "sub-rules: %3}2">;
1176def err_pragma_attribute_duplicate_subject : Error<
1177  "duplicate attribute subject matcher '%0'">;
1178def err_pragma_attribute_expected_period : Error<
1179  "expected '.' after pragma attribute namespace %0">;
1180def err_pragma_attribute_namespace_on_attribute : Error<
1181  "namespace can only apply to 'push' or 'pop' directives">;
1182def note_pragma_attribute_namespace_on_attribute : Note<
1183  "omit the namespace to add attributes to the most-recently"
1184  " pushed attribute group">;
1185
1186def err_opencl_unroll_hint_on_non_loop : Error<
1187  "OpenCL only supports 'opencl_unroll_hint' attribute on for, while, and do statements">;
1188
1189// OpenCL EXTENSION pragma (OpenCL 1.1 [9.1])
1190def warn_pragma_expected_colon : Warning<
1191  "missing ':' after %0 - ignoring">, InGroup<IgnoredPragmas>;
1192def warn_pragma_expected_predicate : Warning<
1193  "expected %select{'enable', 'disable', 'begin' or 'end'|'disable'}0 - ignoring">, InGroup<IgnoredPragmas>;
1194def warn_pragma_begin_end_mismatch : Warning<
1195  "OpenCL extension end directive mismatches begin directive - ignoring">, InGroup<IgnoredPragmas>;
1196def warn_pragma_unknown_extension : Warning<
1197  "unknown OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>;
1198def warn_pragma_unsupported_extension : Warning<
1199  "unsupported OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>;
1200def warn_pragma_extension_is_core : Warning<
1201  "OpenCL extension %0 is core feature or supported optional core feature - ignoring">, InGroup<DiagGroup<"pedantic-core-features">>, DefaultIgnore;
1202
1203// OpenCL errors.
1204def err_opencl_taking_function_address_parser : Error<
1205  "taking address of function is not allowed">;
1206def err_opencl_logical_exclusive_or : Error<
1207  "^^ is a reserved operator in OpenCL">;
1208
1209// C++ for OpenCL.
1210def err_openclcxx_virtual_function : Error<
1211  "virtual functions are not supported in C++ for OpenCL">;
1212
1213// OpenMP support.
1214def warn_pragma_omp_ignored : Warning<
1215  "unexpected '#pragma omp ...' in program">, InGroup<SourceUsesOpenMP>, DefaultIgnore;
1216def warn_omp_extra_tokens_at_eol : Warning<
1217  "extra tokens at the end of '#pragma omp %0' are ignored">,
1218  InGroup<ExtraTokens>;
1219def warn_pragma_expected_colon_r_paren : Warning<
1220  "missing ':' or ')' after %0 - ignoring">, InGroup<IgnoredPragmas>;
1221def err_omp_unknown_directive : Error<
1222  "expected an OpenMP directive">;
1223def err_omp_unexpected_directive : Error<
1224  "unexpected OpenMP directive %select{|'#pragma omp %1'}0">;
1225def err_omp_expected_punc : Error<
1226  "expected ',' or ')' in '%0' %select{clause|directive}1">;
1227def err_omp_unexpected_clause : Error<
1228  "unexpected OpenMP clause '%0' in directive '#pragma omp %1'">;
1229def err_omp_immediate_directive : Error<
1230  "'#pragma omp %0' %select{|with '%2' clause }1cannot be an immediate substatement">;
1231def err_omp_expected_identifier_for_critical : Error<
1232  "expected identifier specifying the name of the 'omp critical' directive">;
1233def err_omp_expected_reduction_identifier : Error<
1234  "expected identifier or one of the following operators: '+', '-', '*', '&', '|', '^', '&&', or '||'">;
1235def err_omp_decl_in_declare_simd_variant : Error<
1236  "function declaration is expected after 'declare %select{simd|variant}0' directive">;
1237def err_omp_unknown_map_type : Error<
1238  "incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'">;
1239def err_omp_unknown_map_type_modifier : Error<
1240  "incorrect map type modifier, expected 'always', 'close', or 'mapper'">;
1241def err_omp_map_type_missing : Error<
1242  "missing map type">;
1243def err_omp_map_type_modifier_missing : Error<
1244  "missing map type modifier">;
1245def err_omp_declare_simd_inbranch_notinbranch : Error<
1246  "unexpected '%0' clause, '%1' is specified already">;
1247def err_expected_end_declare_target : Error<
1248  "expected '#pragma omp end declare target'">;
1249def err_omp_declare_target_unexpected_clause: Error<
1250  "unexpected '%0' clause, only %select{'to' or 'link'|'to', 'link' or 'device_type'}1 clauses expected">;
1251def err_omp_expected_clause: Error<
1252  "expected at least one clause on '#pragma omp %0' directive">;
1253def err_omp_mapper_illegal_identifier : Error<
1254  "illegal OpenMP user-defined mapper identifier">;
1255def err_omp_mapper_expected_declarator : Error<
1256  "expected declarator on 'omp declare mapper' directive">;
1257def err_omp_declare_variant_wrong_clause : Error<
1258  "expected '%0' clause on 'omp declare variant' directive">;
1259def err_omp_declare_variant_no_ctx_selector : Error<
1260  "expected context selector in '%0' clause on 'omp declare variant' directive">;
1261def err_omp_declare_variant_equal_expected : Error<
1262  "expected '=' after '%0' context selector set name on 'omp declare variant' directive">;
1263def warn_omp_declare_variant_cs_name_expected : Warning<
1264  "unknown context selector in '%0' context selector set of 'omp declare variant' directive, ignored">,
1265  InGroup<OpenMPClauses>;
1266def err_omp_declare_variant_item_expected : Error<
1267  "expected %0 in '%1' context selector of '%2' selector set of 'omp declare variant' directive">;
1268def err_omp_declare_variant_ctx_set_mutiple_use : Error<
1269  "context selector set '%0' is used already in the same 'omp declare variant' directive">;
1270def note_omp_declare_variant_ctx_set_used_here : Note<
1271  "previously context selector set '%0' used here">;
1272def err_omp_expected_comma_brace : Error<"expected '}' or ',' after '%0'">;
1273def err_omp_declare_variant_ctx_mutiple_use : Error<
1274  "context trait selector '%0' is used already in the same '%1' context selector set of 'omp declare variant' directive">;
1275def note_omp_declare_variant_ctx_used_here : Note<
1276  "previously context trait selector '%0' used here">;
1277def warn_omp_more_one_device_type_clause : Warning<
1278  "more than one 'device_type' clause is specified">,
1279  InGroup<OpenMPClauses>;
1280def err_omp_wrong_device_kind_trait : Error<
1281  "unknown '%0' device kind trait in the 'device' context selector set, expected"
1282  " one of 'host', 'nohost', 'cpu', 'gpu' or 'fpga'">;
1283
1284// Pragma loop support.
1285def err_pragma_loop_missing_argument : Error<
1286  "missing argument; expected %select{an integer value|"
1287  "'enable'%select{|, 'full'}1%select{|, 'assume_safety'}2 or 'disable'}0">;
1288def err_pragma_loop_invalid_option : Error<
1289  "%select{invalid|missing}0 option%select{ %1|}0; expected vectorize, "
1290  "vectorize_width, interleave, interleave_count, unroll, unroll_count, "
1291  "pipeline, pipeline_initiation_interval, vectorize_predicate, or distribute">;
1292
1293def err_pragma_fp_invalid_option : Error<
1294  "%select{invalid|missing}0 option%select{ %1|}0; expected contract">;
1295def err_pragma_fp_invalid_argument : Error<
1296  "unexpected argument '%0' to '#pragma clang fp %1'; "
1297  "expected 'on', 'fast' or 'off'">;
1298def err_pragma_fp_scope : Error<
1299  "'#pragma clang fp' can only appear at file scope or at the start of a "
1300  "compound statement">;
1301
1302def err_pragma_invalid_keyword : Error<
1303  "invalid argument; expected 'enable'%select{|, 'full'}0%select{|, 'assume_safety'}1 or 'disable'">;
1304def err_pragma_pipeline_invalid_keyword : Error<
1305    "invalid argument; expected 'disable'">;
1306
1307// Pragma unroll support.
1308def warn_pragma_unroll_cuda_value_in_parens : Warning<
1309  "argument to '#pragma unroll' should not be in parentheses in CUDA C/C++">,
1310  InGroup<CudaCompat>;
1311
1312def warn_cuda_attr_lambda_position : Warning<
1313  "nvcc does not allow '__%0__' to appear after '()' in lambdas">,
1314  InGroup<CudaCompat>;
1315def warn_pragma_force_cuda_host_device_bad_arg : Warning<
1316  "incorrect use of #pragma clang force_cuda_host_device begin|end">,
1317  InGroup<IgnoredPragmas>;
1318def err_pragma_cannot_end_force_cuda_host_device : Error<
1319  "force_cuda_host_device end pragma without matching "
1320  "force_cuda_host_device begin">;
1321} // end of Parse Issue category.
1322
1323let CategoryName = "Modules Issue" in {
1324def err_unexpected_module_decl : Error<
1325  "module declaration can only appear at the top level">;
1326def err_module_expected_ident : Error<
1327  "expected a module name after '%select{module|import}0'">;
1328def err_attribute_not_module_attr : Error<
1329  "%0 attribute cannot be applied to a module">;
1330def err_attribute_not_import_attr : Error<
1331  "%0 attribute cannot be applied to a module import">;
1332def err_module_expected_semi : Error<
1333  "expected ';' after module name">;
1334def err_global_module_introducer_not_at_start : Error<
1335  "'module;' introducing a global module fragment can appear only "
1336  "at the start of the translation unit">;
1337def err_module_fragment_exported : Error<
1338  "%select{global|private}0 module fragment cannot be exported">;
1339def err_private_module_fragment_expected_semi : Error<
1340  "expected ';' after private module fragment declaration">;
1341def err_missing_before_module_end : Error<"expected %0 at end of module">;
1342def err_unsupported_module_partition : Error<
1343  "sorry, module partitions are not yet supported">;
1344
1345def err_export_empty : Error<"export declaration cannot be empty">;
1346}
1347
1348let CategoryName = "Generics Issue" in {
1349
1350def err_objc_expected_type_parameter : Error<
1351  "expected type parameter name">;
1352
1353def err_objc_parameterized_implementation : Error<
1354  "@implementation cannot have type parameters">;
1355
1356def err_objc_type_args_after_protocols : Error<
1357  "protocol qualifiers must precede type arguments">;
1358
1359def note_meant_to_use_typename : Note<
1360  "did you mean to use 'typename'?">;
1361}
1362
1363let CategoryName = "Coroutines Issue" in {
1364def err_for_co_await_not_range_for : Error<
1365  "'co_await' modifier can only be applied to range-based for loop">;
1366}
1367
1368let CategoryName = "Concepts Issue" in {
1369def err_concept_definition_not_identifier : Error<
1370  "name defined in concept definition must be an identifier">;
1371def ext_concept_legacy_bool_keyword : ExtWarn<
1372  "ISO C++20 does not permit the 'bool' keyword after 'concept'">,
1373  InGroup<DiagGroup<"concepts-ts-compat">>;
1374def err_placeholder_expected_auto_or_decltype_auto : Error<
1375  "expected 'auto' or 'decltype(auto)' after concept name">;
1376}
1377
1378} // end of Parser diagnostics
1379