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