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