DiagnosticSerializationKinds.td revision 353358
1//==--- DiagnosticSerializationKinds.td - serialization 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
9let Component = "Serialization" in {
10let CategoryName = "AST Deserialization Issue" in {
11
12def err_fe_unable_to_read_pch_file : Error<
13    "unable to read PCH file %0: '%1'">;
14def err_fe_not_a_pch_file : Error<
15    "input is not a PCH file: '%0'">;
16def err_fe_pch_malformed : Error<
17    "malformed or corrupted AST file: '%0'">, DefaultFatal;
18def err_fe_pch_malformed_block : Error<
19    "malformed block record in PCH file: '%0'">, DefaultFatal;
20def err_fe_pch_file_modified : Error<
21    "file '%0' has been modified since the precompiled header '%1' was built">,
22    DefaultFatal;
23def err_fe_module_file_modified : Error<
24    "file '%0' has been modified since the module file '%1' was built">,
25    DefaultFatal;
26def err_fe_ast_file_modified : Error<
27    "file '%0' has been modified since the AST file '%1' was built">,
28    DefaultFatal;
29def err_fe_pch_file_overridden : Error<
30    "file '%0' from the precompiled header has been overridden">;
31def note_pch_required_by : Note<"'%0' required by '%1'">;
32def note_pch_rebuild_required : Note<"please rebuild precompiled header '%0'">;
33def note_module_cache_path : Note<
34    "after modifying system headers, please delete the module cache at '%0'">;
35
36def err_pch_targetopt_mismatch : Error<
37    "PCH file was compiled for the %0 '%1' but the current translation "
38    "unit is being compiled for target '%2'">;
39def err_pch_targetopt_feature_mismatch : Error<
40    "%select{AST file was|current translation unit is}0 compiled with the target "
41    "feature '%1' but the %select{current translation unit is|AST file was}0 "
42    "not">;
43def err_pch_langopt_mismatch : Error<"%0 was %select{disabled|enabled}1 in "
44    "PCH file but is currently %select{disabled|enabled}2">;
45def err_pch_langopt_value_mismatch : Error<
46  "%0 differs in PCH file vs. current file">;
47def err_pch_diagopt_mismatch : Error<"%0 is currently enabled, but was not in "
48  "the PCH file">;
49def err_pch_modulecache_mismatch : Error<"PCH was compiled with module cache "
50  "path '%0', but the path is currently '%1'">;
51
52def err_pch_version_too_old : Error<
53    "PCH file uses an older PCH format that is no longer supported">;
54def err_pch_version_too_new : Error<
55    "PCH file uses a newer PCH format that cannot be read">;
56def err_pch_different_branch : Error<
57    "PCH file built from a different branch (%0) than the compiler (%1)">;
58def err_pch_with_compiler_errors : Error<
59    "PCH file contains compiler errors">;
60
61def err_module_file_conflict : Error<
62  "module '%0' is defined in both '%1' and '%2'">, DefaultFatal;
63def err_module_file_not_found : Error<
64  "%select{PCH|module|AST}0 file '%1' not found%select{|: %3}2">, DefaultFatal;
65def err_module_file_out_of_date : Error<
66  "%select{PCH|module|AST}0 file '%1' is out of date and "
67  "needs to be rebuilt%select{|: %3}2">, DefaultFatal;
68def err_module_file_invalid : Error<
69  "file '%1' is not a valid precompiled %select{PCH|module|AST}0 file">, DefaultFatal;
70def note_module_file_imported_by : Note<
71  "imported by %select{|module '%2' in }1'%0'">;
72def err_module_file_not_module : Error<
73  "AST file '%0' was not built as a module">, DefaultFatal;
74
75def remark_module_import : Remark<
76  "importing module '%0'%select{| into '%3'}2 from '%1'">,
77  InGroup<ModuleImport>;
78
79def err_imported_module_not_found : Error<
80    "module '%0' in AST file '%1' (imported by AST file '%2') "
81    "is not defined in any loaded module map file; "
82    "maybe you need to load '%3'?">, DefaultFatal;
83def note_imported_by_pch_module_not_found : Note<
84    "consider adding '%0' to the header search path">;
85def err_imported_module_modmap_changed : Error<
86    "module '%0' imported by AST file '%1' found in a different module map file"
87    " (%2) than when the importing AST file was built (%3)">, DefaultFatal;
88def err_imported_module_relocated : Error<
89    "module '%0' was built in directory '%1' but now resides in "
90    "directory '%2'">, DefaultFatal;
91def err_module_different_modmap : Error<
92    "module '%0' %select{uses|does not use}1 additional module map '%2'"
93    "%select{| not}1 used when the module was built">;
94
95def err_pch_macro_def_undef : Error<
96    "macro '%0' was %select{defined|undef'd}1 in the precompiled header but "
97    "%select{undef'd|defined}1 on the command line">;
98def err_pch_macro_def_conflict : Error<
99    "definition of macro '%0' differs between the precompiled header ('%1') "
100    "and the command line ('%2')">;
101def err_pch_undef : Error<
102    "%select{command line contains|precompiled header was built with}0 "
103    "'-undef' but %select{precompiled header was not built with it|"
104    "it is not present on the command line}0">;
105def err_pch_pp_detailed_record : Error<
106    "%select{command line contains|precompiled header was built with}0 "
107    "'-detailed-preprocessing-record' but %select{precompiled header was not "
108    "built with it|it is not present on the command line}0">;
109
110def err_module_odr_violation_missing_decl : Error<
111  "%q0 from module '%1' is not present in definition of %q2"
112  "%select{ in module '%4'| provided earlier}3">, NoSFINAE;
113def note_module_odr_violation_no_possible_decls : Note<
114  "definition has no member %0">;
115def note_module_odr_violation_possible_decl : Note<
116  "declaration of %0 does not match">;
117def err_module_odr_violation_different_definitions : Error<
118  "%q0 has different definitions in different modules; "
119  "%select{definition in module '%2' is here|defined here}1">;
120def note_first_module_difference : Note<
121  "in first definition, possible difference is here">;
122def note_module_odr_violation_different_definitions : Note<
123  "definition in module '%0' is here">;
124def note_second_module_difference : Note<
125  "in second definition, possible difference is here">;
126
127def err_module_odr_violation_different_instantiations : Error<
128  "instantiation of %q0 is different in different modules">;
129
130def err_module_odr_violation_definition_data : Error <
131  "%q0 has different definitions in different modules; first difference is "
132  "%select{definition in module '%2'|defined here}1 found "
133  "%select{"
134  "%4 base %plural{1:class|:classes}4|"
135  "%4 virtual base %plural{1:class|:classes}4|"
136  "%ordinal4 base class with type %5|"
137  "%ordinal4 %select{non-virtual|virtual}5 base class %6|"
138  "%ordinal4 base class %5 with "
139  "%select{public|protected|private|no}6 access specifier}3">;
140
141def note_module_odr_violation_definition_data : Note <
142  "but in '%0' found "
143  "%select{"
144  "%2 base %plural{1:class|:classes}2|"
145  "%2 virtual base %plural{1:class|:classes}2|"
146  "%ordinal2 base class with different type %3|"
147  "%ordinal2 %select{non-virtual|virtual}3 base class %4|"
148  "%ordinal2 base class %3 with "
149  "%select{public|protected|private|no}4 access specifier}1">;
150
151def err_module_odr_violation_template_parameter : Error <
152  "%q0 has different definitions in different modules; first difference is "
153  "%select{definition in module '%2'|defined here}1 found "
154  "%select{"
155  "unnamed template parameter|"
156  "template parameter %4|"
157  "template parameter with %select{no |}4default argument|"
158  "template parameter with default argument}3">;
159
160
161def note_module_odr_violation_template_parameter : Note <
162  "but in '%0' found "
163  "%select{"
164  "unnamed template parameter %2|"
165  "template parameter %2|"
166  "template parameter with %select{no |}2default argument|"
167  "template parameter with different default argument}1">;
168
169def err_module_odr_violation_mismatch_decl : Error<
170  "%q0 has different definitions in different modules; first difference is "
171  "%select{definition in module '%2'|defined here}1 found "
172  "%select{end of class|public access specifier|private access specifier|"
173  "protected access specifier|static assert|field|method|type alias|typedef|"
174  "data member|friend declaration|function template}3">;
175def note_module_odr_violation_mismatch_decl : Note<"but in '%0' found "
176  "%select{end of class|public access specifier|private access specifier|"
177  "protected access specifier|static assert|field|method|type alias|typedef|"
178  "data member|friend declaration|function template}1">;
179
180def err_module_odr_violation_mismatch_decl_diff : Error<
181  "%q0 has different definitions in different modules; first difference is "
182  "%select{definition in module '%2'|defined here}1 found "
183  "%select{"
184  "static assert with condition|"
185  "static assert with message|"
186  "static assert with %select{|no }4message|"
187  "field %4|"
188  "field %4 with type %5|"
189  "%select{non-|}5bitfield %4|"
190  "bitfield %4 with one width expression|"
191  "%select{non-|}5mutable field %4|"
192  "field %4 with %select{no|an}5 initalizer|"
193  "field %4 with an initializer|"
194  "%select{method %5|constructor|destructor}4|"
195  "%select{method %5|constructor|destructor}4 "
196    "is %select{not deleted|deleted}6|"
197  "%select{method %5|constructor|destructor}4 "
198    "is %select{not defaulted|defaulted}6|"
199  "%select{method %5|constructor|destructor}4 "
200    "is %select{|pure }6%select{not virtual|virtual}7|"
201  "%select{method %5|constructor|destructor}4 "
202    "is %select{not static|static}6|"
203  "%select{method %5|constructor|destructor}4 "
204    "is %select{not volatile|volatile}6|"
205  "%select{method %5|constructor|destructor}4 "
206    "is %select{not const|const}6|"
207  "%select{method %5|constructor|destructor}4 "
208    "is %select{not inline|inline}6|"
209  "%select{method %5|constructor|destructor}4 "
210    "that has %6 parameter%s6|"
211  "%select{method %5|constructor|destructor}4 "
212    "with %ordinal6 parameter of type %7%select{| decayed from %9}8|"
213  "%select{method %5|constructor|destructor}4 "
214    "with %ordinal6 parameter named %7|"
215  "%select{method %5|constructor|destructor}4 "
216    "with %ordinal6 parameter with%select{out|}7 a default argument|"
217  "%select{method %5|constructor|destructor}4 "
218    "with %ordinal6 parameter with a default argument|"
219  "%select{method %5|constructor|destructor}4 "
220    "with %select{no |}6template arguments|"
221  "%select{method %5|constructor|destructor}4 "
222    "with %6 template argument%s6|"
223  "%select{method %5|constructor|destructor}4 "
224    "with %6 for %ordinal7 template argument|"
225  "%select{method %5|constructor|destructor}4 "
226    "with %select{no body|body}6|"
227  "%select{method %5|constructor|destructor}4 "
228    "with body|"
229  "%select{typedef|type alias}4 name %5|"
230  "%select{typedef|type alias}4 %5 with underlying type %6|"
231  "data member with name %4|"
232  "data member %4 with type %5|"
233  "data member %4 with%select{out|}5 an initializer|"
234  "data member %4 with an initializer|"
235  "data member %4 %select{is constexpr|is not constexpr}5|"
236  "friend %select{class|function}4|"
237  "friend %4|"
238  "friend function %4|"
239  "function template %4 with %5 template parameter%s5|"
240  "function template %4 with %ordinal5 template parameter being a "
241    "%select{type|non-type|template}6 template parameter|"
242  "function template %4 with %ordinal5 template parameter "
243    "%select{with no name|named %7}6|"
244  "function template %4 with %ordinal5 template parameter with "
245    "%select{no |}6default argument|"
246  "function template %4 with %ordinal5 template parameter with "
247    "default argument %6|"
248  "function template %4 with %ordinal5 template parameter with one type|"
249  "function template %4 with %ordinal5 template parameter %select{not |}6"
250    "being a template parameter pack|"
251  "}3">;
252
253def note_module_odr_violation_mismatch_decl_diff : Note<"but in '%0' found "
254  "%select{"
255  "static assert with different condition|"
256  "static assert with different message|"
257  "static assert with %select{|no }2message|"
258  "field %2|"
259  "field %2 with type %3|"
260  "%select{non-|}3bitfield %2|"
261  "bitfield %2 with different width expression|"
262  "%select{non-|}3mutable field %2|"
263  "field %2 with %select{no|an}3 initializer|"
264  "field %2 with a different initializer|"
265  "%select{method %3|constructor|destructor}2|"
266  "%select{method %3|constructor|destructor}2 "
267    "is %select{not deleted|deleted}4|"
268  "%select{method %3|constructor|destructor}2 "
269    "is %select{not defaulted|defaulted}4|"
270  "%select{method %3|constructor|destructor}2 "
271    "is %select{|pure }4%select{not virtual|virtual}5|"
272  "%select{method %3|constructor|destructor}2 "
273    "is %select{not static|static}4|"
274  "%select{method %3|constructor|destructor}2 "
275    "is %select{not volatile|volatile}4|"
276  "%select{method %3|constructor|destructor}2 "
277    "is %select{not const|const}4|"
278  "%select{method %3|constructor|destructor}2 "
279    "is %select{not inline|inline}4|"
280  "%select{method %3|constructor|destructor}2 "
281    "that has %4 parameter%s4|"
282  "%select{method %3|constructor|destructor}2 "
283    "with %ordinal4 parameter of type %5%select{| decayed from %7}6|"
284  "%select{method %3|constructor|destructor}2 "
285    "with %ordinal4 parameter named %5|"
286  "%select{method %3|constructor|destructor}2 "
287    "with %ordinal4 parameter with%select{out|}5 a default argument|"
288  "%select{method %3|constructor|destructor}2 "
289    "with %ordinal4 parameter with a different default argument|"
290  "%select{method %3|constructor|destructor}2 "
291    "with %select{no |}4template arguments|"
292  "%select{method %3|constructor|destructor}2 "
293    "with %4 template argument%s4|"
294  "%select{method %3|constructor|destructor}2 "
295    "with %4 for %ordinal5 template argument|"
296  "%select{method %3|constructor|destructor}2 "
297    "with %select{no body|body}4|"
298  "%select{method %3|constructor|destructor}2 "
299    "with different body|"
300  "%select{typedef|type alias}2 name %3|"
301  "%select{typedef|type alias}2 %3 with different underlying type %4|"
302  "data member with name %2|"
303  "data member %2 with different type %3|"
304  "data member %2 with%select{out|}3 an initializer|"
305  "data member %2 with a different initializer|"
306  "data member %2 %select{is constexpr|is not constexpr}3|"
307  "friend %select{class|function}2|"
308  "friend %2|"
309  "friend function %2|"
310  "function template %2 with %3 template parameter%s3|"
311  "function template %2 with %ordinal3 template paramter being a "
312    "%select{type|non-type|template}4 template parameter|"
313  "function template %2 with %ordinal3 template parameter "
314    "%select{with no name|named %5}4|"
315  "function template %2 with %ordinal3 template parameter with "
316    "%select{no |}4default argument|"
317  "function template %2 with %ordinal3 template parameter with "
318    "default argument %4|"
319  "function template %2 with %ordinal3 template parameter with different type|"
320  "function template %2 with %ordinal3 template parameter %select{not |}4"
321    "being a template parameter pack|"
322  "}1">;
323
324def err_module_odr_violation_function : Error<
325  "%q0 has different definitions in different modules; "
326  "%select{definition in module '%2'|defined here}1 "
327  "first difference is "
328  "%select{"
329  "return type is %4|"
330  "%ordinal4 parameter with name %5|"
331  "%ordinal4 parameter with type %5%select{| decayed from %7}6|"
332  "%ordinal4 parameter with%select{out|}5 a default argument|"
333  "%ordinal4 parameter with a default argument|"
334  "function body"
335  "}3">;
336
337def note_module_odr_violation_function : Note<"but in '%0' found "
338  "%select{"
339  "different return type %2|"
340  "%ordinal2 parameter with name %3|"
341  "%ordinal2 parameter with type %3%select{| decayed from %5}4|"
342  "%ordinal2 parameter with%select{out|}3 a default argument|"
343  "%ordinal2 parameter with a different default argument|"
344  "a different body"
345  "}1">;
346
347def err_module_odr_violation_enum : Error<
348  "%q0 has different definitions in different modules; "
349  "%select{definition in module '%2'|defined here}1 "
350  "first difference is "
351  "%select{"
352  "enum that is %select{not scoped|scoped}4|"
353  "enum scoped with keyword %select{struct|class}4|"
354  "enum %select{without|with}4 specified type|"
355  "enum with specified type %4|"
356  "enum with %4 element%s4|"
357  "%ordinal4 element has name %5|"
358  "%ordinal4 element %5 %select{has|does not have}6 an initilizer|"
359  "%ordinal4 element %5 has an initializer|"
360  "}3">;
361
362def note_module_odr_violation_enum : Note<"but in '%0' found "
363  "%select{"
364  "enum that is %select{not scoped|scoped}2|"
365  "enum scoped with keyword %select{struct|class}2|"
366  "enum %select{without|with}2 specified type|"
367  "enum with specified type %2|"
368  "enum with %2 element%s2|"
369  "%ordinal2 element has name %3|"
370  "%ordinal2 element %3 %select{has|does not have}4 an initializer|"
371  "%ordinal2 element %3 has different initializer|"
372  "}1">;
373
374def err_module_odr_violation_mismatch_decl_unknown : Error<
375  "%q0 %select{with definition in module '%2'|defined here}1 has different "
376  "definitions in different modules; first difference is this "
377  "%select{||||static assert|field|method|type alias|typedef|data member|"
378  "friend declaration|unexpected decl}3">;
379def note_module_odr_violation_mismatch_decl_unknown : Note<
380  "but in '%0' found "
381  "%select{||||different static assert|different field|different method|"
382  "different type alias|different typedef|different data member|"
383  "different friend declaration|another unexpected decl}1">;
384
385def warn_duplicate_module_file_extension : Warning<
386  "duplicate module file extension block name '%0'">,
387  InGroup<ModuleFileExtension>;
388
389def warn_module_system_bit_conflict : Warning<
390  "module file '%0' was validated as a system module and is now being imported "
391  "as a non-system module; any difference in diagnostic options will be ignored">,
392  InGroup<ModuleConflict>;
393} // let CategoryName
394
395let CategoryName = "AST Serialization Issue" in {
396def warn_module_uses_date_time : Warning<
397  "%select{precompiled header|module}0 uses __DATE__ or __TIME__">,
398  InGroup<DiagGroup<"pch-date-time">>;
399def err_module_no_size_mtime_for_header : Error<
400  "cannot emit module %0: %select{size|mtime}1 must be explicitly specified "
401  "for missing header file \"%2\"">;
402} // let CategoryName
403} // let Component
404
405