blob: b556da9f54fb5eec5169ce235b7bcb4895c7aa7e [file] [log] [blame]
Richard Smith0f99d6a2015-08-09 08:48:41 +00001// RUN: rm -rf %t
2// RUN: mkdir %t
3// RUN: echo 'extern int a;' > %t/a.h
Richard Smitha24ff552015-08-11 00:05:21 +00004// RUN: echo 'extern int b; template<typename T> int b2 = T::error;' > %t/b.h
Richard Smith0f99d6a2015-08-09 08:48:41 +00005// 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 Smitha24ff552015-08-11 00:05:21 +000013// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s
Richard Smith0f99d6a2015-08-09 08:48:41 +000014// RUN: rm %t/modulemap
15// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s
Richard Smitha24ff552015-08-11 00:05:21 +000016// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s
Richard Smith0f99d6a2015-08-09 08:48:41 +000017// RUN: rm %t/b.h
18// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s
Richard Smitha24ff552015-08-11 00:05:21 +000019// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s --check-prefix=MISSING-B
Richard Smith0f99d6a2015-08-09 08:48:41 +000020// 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}}
24int x = b;
Richard Smitha24ff552015-08-11 00:05:21 +000025
26#ifdef ERRORS
27int 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 Smithd61c1f82015-08-11 00:32:42 +000032// MISSING-B-NOT: please delete the module cache
Richard Smitha24ff552015-08-11 00:05:21 +000033#endif