Richard Smith | 0f99d6a | 2015-08-09 08:48:41 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
| 2 | // RUN: mkdir %t |
Richard Smith | fb1e7f7 | 2015-08-14 05:02:58 +0000 | [diff] [blame^] | 3 | // RUN: echo 'extern int a; template<typename T> int a2 = T::error;' > %t/a.h |
| 4 | // RUN: echo 'extern int b;' > %t/b.h |
| 5 | // RUN: echo 'extern int c = 0;' > %t/c.h |
| 6 | // RUN: echo 'module a { header "a.h" header "b.h" header "c.h" }' > %t/modulemap |
| 7 | // RUN: echo 'module other {}' > %t/other.modulemap |
Richard Smith | 0f99d6a | 2015-08-09 08:48:41 +0000 | [diff] [blame] | 8 | |
| 9 | // We lazily check that the files referenced by an explicitly-specified .pcm |
| 10 | // file exist. Test this by removing files and ensuring that the compilation |
| 11 | // still succeeds. |
| 12 | // |
Richard Smith | fb1e7f7 | 2015-08-14 05:02:58 +0000 | [diff] [blame^] | 13 | // RUN: %clang_cc1 -fmodules -I %t -emit-module -fmodule-name=a -x c++ %t/modulemap -o %t/a.pcm \ |
| 14 | // RUN: -fmodule-map-file=%t/other.modulemap \ |
| 15 | // RUN: -fmodules-embed-file=%t/modulemap -fmodules-embed-file=%t/other.modulemap |
Richard Smith | 0f99d6a | 2015-08-09 08:48:41 +0000 | [diff] [blame] | 16 | // RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s |
Richard Smith | a24ff55 | 2015-08-11 00:05:21 +0000 | [diff] [blame] | 17 | // RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s |
Richard Smith | 0f99d6a | 2015-08-09 08:48:41 +0000 | [diff] [blame] | 18 | // RUN: rm %t/modulemap |
| 19 | // RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s |
Richard Smith | a24ff55 | 2015-08-11 00:05:21 +0000 | [diff] [blame] | 20 | // RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s |
Richard Smith | fb1e7f7 | 2015-08-14 05:02:58 +0000 | [diff] [blame^] | 21 | // RUN: rm %t/other.modulemap |
| 22 | // RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s |
| 23 | // RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s |
Richard Smith | 0f99d6a | 2015-08-09 08:48:41 +0000 | [diff] [blame] | 24 | // RUN: rm %t/b.h |
| 25 | // RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s |
Richard Smith | a24ff55 | 2015-08-11 00:05:21 +0000 | [diff] [blame] | 26 | // RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s --check-prefix=MISSING-B |
Richard Smith | 0f99d6a | 2015-08-09 08:48:41 +0000 | [diff] [blame] | 27 | // RUN: rm %t/a.h |
| 28 | // RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -verify |
| 29 | |
| 30 | #include "a.h" // expected-error {{file not found}} |
| 31 | int x = b; |
Richard Smith | a24ff55 | 2015-08-11 00:05:21 +0000 | [diff] [blame] | 32 | |
| 33 | #ifdef ERRORS |
Richard Smith | fb1e7f7 | 2015-08-14 05:02:58 +0000 | [diff] [blame^] | 34 | int y = a2<int>; |
Richard Smith | a24ff55 | 2015-08-11 00:05:21 +0000 | [diff] [blame] | 35 | // CHECK: In module 'a': |
Richard Smith | fb1e7f7 | 2015-08-14 05:02:58 +0000 | [diff] [blame^] | 36 | // CHECK-NEXT: a.h:1:45: error: |
Richard Smith | a24ff55 | 2015-08-11 00:05:21 +0000 | [diff] [blame] | 37 | |
| 38 | // MISSING-B: could not find file '{{.*}}b.h' |
Richard Smith | d61c1f8 | 2015-08-11 00:32:42 +0000 | [diff] [blame] | 39 | // MISSING-B-NOT: please delete the module cache |
Richard Smith | a24ff55 | 2015-08-11 00:05:21 +0000 | [diff] [blame] | 40 | #endif |
Richard Smith | fb1e7f7 | 2015-08-14 05:02:58 +0000 | [diff] [blame^] | 41 | |
| 42 | // RUN: not %clang_cc1 -fmodules -I %t -emit-module -fmodule-name=a -x c++ /dev/null -o %t/a.pcm \ |
| 43 | // RUN: -fmodules-embed-file=%t/does-not-exist 2>&1 | FileCheck %s --check-prefix=MISSING-EMBED |
| 44 | // MISSING-EMBED: fatal error: file '{{.*}}does-not-exist' specified by '-fmodules-embed-file=' not found |