Richard Smith | 3c1a41a | 2014-12-02 00:08:08 +0000 | [diff] [blame] | 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 | // |
NAKAMURA Takumi | 8ca1b5a | 2014-12-02 03:55:16 +0000 | [diff] [blame] | 4 | // REQUIRES: shell |
| 5 | // |
Richard Smith | 34f3051 | 2013-11-23 04:06:09 +0000 | [diff] [blame] | 6 | // RUN: rm -rf %t |
Richard Smith | 3c1a41a | 2014-12-02 00:08:08 +0000 | [diff] [blame] | 7 | // RUN: cd %S |
| 8 | // 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 | // RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -I Inputs/malformed -DHEADER="b1.h" %s 2>&1 | FileCheck %s --check-prefix=CHECK-B |
Richard Smith | 223d3f2 | 2014-12-06 03:21:08 +0000 | [diff] [blame^] | 10 | // 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 |
Richard Smith | 34f3051 | 2013-11-23 04:06:09 +0000 | [diff] [blame] | 11 | |
| 12 | #define STR2(x) #x |
| 13 | #define STR(x) STR2(x) |
| 14 | #include STR(HEADER) |
| 15 | |
Richard Smith | 556f03e | 2013-11-23 05:21:32 +0000 | [diff] [blame] | 16 | // CHECK-A: While building module 'malformed_a' |
Richard Smith | 3c1a41a | 2014-12-02 00:08:08 +0000 | [diff] [blame] | 17 | // CHECK-A: {{^}}Inputs/malformed/a1.h:1:{{.*}} error: expected '}' |
| 18 | // CHECK-A: {{^}}Inputs/malformed/a1.h:1:{{.*}} note: to match this '{' |
Richard Smith | 34f3051 | 2013-11-23 04:06:09 +0000 | [diff] [blame] | 19 | // |
Richard Smith | 556f03e | 2013-11-23 05:21:32 +0000 | [diff] [blame] | 20 | // CHECK-A: While building module 'malformed_a' |
Richard Smith | 3c1a41a | 2014-12-02 00:08:08 +0000 | [diff] [blame] | 21 | // CHECK-A: {{^}}Inputs/malformed/a2.h:1:{{.*}} error: extraneous closing brace |
Richard Smith | 34f3051 | 2013-11-23 04:06:09 +0000 | [diff] [blame] | 22 | |
Richard Smith | 556f03e | 2013-11-23 05:21:32 +0000 | [diff] [blame] | 23 | // CHECK-B: While building module 'malformed_b' |
Richard Smith | 3c1a41a | 2014-12-02 00:08:08 +0000 | [diff] [blame] | 24 | // CHECK-B: {{^}}Inputs/malformed/b1.h:2:{{.*}} error: expected '}' |
| 25 | // CHECK-B: {{^}}Inputs/malformed/b1.h:1:{{.*}} note: to match this '{' |
| 26 | // CHECK-B: {{^}}Inputs/malformed/b1.h:3:{{.*}} error: extraneous closing brace ('}') |
Richard Smith | 34f3051 | 2013-11-23 04:06:09 +0000 | [diff] [blame] | 27 | // |
Richard Smith | 556f03e | 2013-11-23 05:21:32 +0000 | [diff] [blame] | 28 | // CHECK-B: While building module 'malformed_b' |
Richard Smith | 3c1a41a | 2014-12-02 00:08:08 +0000 | [diff] [blame] | 29 | // CHECK-B: {{^}}Inputs/malformed/b2.h:1:{{.*}} error: redefinition of 'g' |
| 30 | // CHECK-B: {{^}}Inputs/malformed/b2.h:1:{{.*}} note: previous definition is here |
Richard Smith | 223d3f2 | 2014-12-06 03:21:08 +0000 | [diff] [blame^] | 31 | |
| 32 | void test() { f<int>(); } |
| 33 | // Test that we use relative paths to name files within an imported module. |
| 34 | // |
| 35 | // CHECK-C: In module 'c' imported from malformed.cpp:14: |
| 36 | // CHECK-C: {{^}}Inputs/malformed/c.h:1:33: error: type 'int' cannot be used prior to '::' |
| 37 | // CHECK-C: {{^}}malformed.cpp:[[@LINE-5]]:15: note: in instantiation of |