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