2 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -emit-module -fmodules-cache-path=%t -fmodule-name=diag_pragma -x c++ %S/Inputs/module.modulemap -std=c++20
3 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -std=c++20
4 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -emit-module -fmodule-name=diag_pragma -x c++ %S/Inputs/module.modulemap -std=c++20 -o %t/explicit.pcm -Werror=string-plus-int
5 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -std=c++20 -DEXPLICIT_FLAG -fmodule-file=%t/explicit.pcm
7 #include "diag_pragma.h"
10 // Diagnostics from templates in the module follow the diagnostic state from
11 // when the module was built.
13 // expected-error@diag_pragma.h:7 {{adding 'int' to a string}}
15 // expected-warning@diag_pragma.h:7 {{adding 'int' to a string}}
17 // expected-note@diag_pragma.h:7 {{use array indexing}}
18 f(0); // expected-note {{instantiation of}}
20 g(0); // ok, warning was ignored when building module
22 // Diagnostics from this source file ignore the diagnostic state from the
24 void("foo" + x
); // expected-warning {{adding 'int' to a string}}
25 // expected-note@-1 {{use array indexing}}
27 #pragma clang diagnostic ignored "-Wstring-plus-int"
29 // Diagnostics from the module ignore diagnostic state changes from this
32 // expected-error@diag_pragma.h:7 {{adding 'long' to a string}}
34 // expected-warning@diag_pragma.h:7 {{adding 'long' to a string}}
36 // expected-note@diag_pragma.h:7 {{use array indexing}}
37 f(0L); // expected-note {{instantiation of}}
43 if (x
= DIAG_PRAGMA_MACRO
) // expected-warning {{using the result of an assignment as a condition without parentheses}} \
44 // expected-note {{place parentheses}} expected-note {{use '=='}}