xref: /minix3/external/bsd/llvm/dist/clang/test/Modules/malformed.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // This test explicitly cd's to the test/Modules directory so that we can test
2*0a6a1f1dSLionel Sambuc // that filenames found via relative -I paths are printed correctly.
3*0a6a1f1dSLionel Sambuc //
4*0a6a1f1dSLionel Sambuc // REQUIRES: shell
5*0a6a1f1dSLionel Sambuc //
6*0a6a1f1dSLionel Sambuc // RUN: rm -rf %t
7*0a6a1f1dSLionel Sambuc // RUN: cd %S
8*0a6a1f1dSLionel Sambuc // RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -I Inputs/malformed -DHEADER="a1.h" %s 2>&1 | FileCheck %s --check-prefix=CHECK-A
9*0a6a1f1dSLionel Sambuc // RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -I Inputs/malformed -DHEADER="b1.h" %s 2>&1 | FileCheck %s --check-prefix=CHECK-B
10*0a6a1f1dSLionel Sambuc // RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -I Inputs/malformed -DHEADER="c.h" malformed.cpp 2>&1 | FileCheck %s --check-prefix=CHECK-C
11*0a6a1f1dSLionel Sambuc 
12*0a6a1f1dSLionel Sambuc #define STR2(x) #x
13*0a6a1f1dSLionel Sambuc #define STR(x) STR2(x)
14*0a6a1f1dSLionel Sambuc #include STR(HEADER)
15*0a6a1f1dSLionel Sambuc 
16*0a6a1f1dSLionel Sambuc // CHECK-A: While building module 'malformed_a'
17*0a6a1f1dSLionel Sambuc // CHECK-A: {{^}}Inputs/malformed/a1.h:1:{{.*}} error: expected '}'
18*0a6a1f1dSLionel Sambuc // CHECK-A: {{^}}Inputs/malformed/a1.h:1:{{.*}} note: to match this '{'
19*0a6a1f1dSLionel Sambuc //
20*0a6a1f1dSLionel Sambuc // CHECK-A: While building module 'malformed_a'
21*0a6a1f1dSLionel Sambuc // CHECK-A: {{^}}Inputs/malformed/a2.h:1:{{.*}} error: extraneous closing brace
22*0a6a1f1dSLionel Sambuc 
23*0a6a1f1dSLionel Sambuc // CHECK-B: While building module 'malformed_b'
24*0a6a1f1dSLionel Sambuc // CHECK-B: {{^}}Inputs/malformed/b1.h:2:{{.*}} error: expected '}'
25*0a6a1f1dSLionel Sambuc // CHECK-B: {{^}}Inputs/malformed/b1.h:1:{{.*}} note: to match this '{'
26*0a6a1f1dSLionel Sambuc // CHECK-B: {{^}}Inputs/malformed/b1.h:3:{{.*}} error: extraneous closing brace ('}')
27*0a6a1f1dSLionel Sambuc //
28*0a6a1f1dSLionel Sambuc // CHECK-B: While building module 'malformed_b'
29*0a6a1f1dSLionel Sambuc // CHECK-B: {{^}}Inputs/malformed/b2.h:1:{{.*}} error: redefinition of 'g'
30*0a6a1f1dSLionel Sambuc // CHECK-B: {{^}}Inputs/malformed/b2.h:1:{{.*}} note: previous definition is here
31*0a6a1f1dSLionel Sambuc 
test()32*0a6a1f1dSLionel Sambuc void test() { f<int>(); }
33*0a6a1f1dSLionel Sambuc // Test that we use relative paths to name files within an imported module.
34*0a6a1f1dSLionel Sambuc //
35*0a6a1f1dSLionel Sambuc // CHECK-C: In module 'c' imported from malformed.cpp:14:
36*0a6a1f1dSLionel Sambuc // CHECK-C: {{^}}Inputs/malformed/c.h:1:33: error: type 'int' cannot be used prior to '::'
37*0a6a1f1dSLionel Sambuc // CHECK-C: {{^}}malformed.cpp:[[@LINE-5]]:15: note: in instantiation of
38