[clang][lex] NFCI: Use DirectoryEntryRef in ModuleMap::inferFrameworkModule()
[llvm-project.git] / clang / test / Misc / warn-sysheader.cpp
blobdbc38258c4d234395f2bc88e772c24a66858125b
1 // Test that -Wsystem-headers works with default and custom mappings like -Werror.
2 // Keep run lines at the bottom for line number stability.
4 #ifdef IS_SYSHEADER
5 #pragma clang system_header
7 int f() { return (int)0; } // Use the old-style-cast warning as an arbitrary "ordinary" diagnostic for the purpose of testing.
9 #warning "custom message"
11 #if defined(A) || defined(B)
12 // expected-warning@9 {{"custom message"}}
13 #elif defined(C)
14 // expected-warning@7 {{use of old-style cast}}
15 // expected-warning@9 {{"custom message"}}
16 #elif defined(D)
17 // expected-error@7 {{use of old-style cast}}
18 // expected-error@9 {{"custom message"}}
19 #elif defined(E)
20 // expected-error@7 {{use of old-style cast}}
21 // expected-warning@9 {{"custom message"}}
22 #endif
24 #else
25 #define IS_SYSHEADER
26 #include __FILE__
27 #endif
29 // RUN: %clang_cc1 -verify -fsyntax-only -DA %s
30 // RUN: %clang_cc1 -verify -fsyntax-only -DB -Wold-style-cast %s
31 // RUN: %clang_cc1 -verify -fsyntax-only -DC -Wold-style-cast -Wsystem-headers %s
32 // RUN: %clang_cc1 -verify -fsyntax-only -DD -Wold-style-cast -Wsystem-headers -Werror %s
33 // RUN: %clang_cc1 -verify -fsyntax-only -DE -Wold-style-cast -Wsystem-headers -Werror=old-style-cast %s