61 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir %t3// RUN: echo 'extern int a; template<typename T> int a2 = T::error;' > %t/a.h4// RUN: echo 'extern int b;' > %t/b.h5// RUN: echo 'extern int c = 0;' > %t/c.h6// RUN: echo 'module a { module aa { header "a.h" header "b.h" header "c.h" } }' > %t/modulemap7// RUN: echo 'module other {}' > %t/other.modulemap8 9// We lazily check that the files referenced by an explicitly-specified .pcm10// file exist. Test this by removing files and ensuring that the compilation11// still succeeds.12//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.modulemap16// RUN: %clang_cc1 -fmodules -I %t -emit-module -fmodule-name=a -x c++ %t/modulemap -o %t/b.pcm \17// RUN: -fmodule-map-file=%t/other.modulemap \18// RUN: -fmodules-embed-all-files19// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s20// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s21// RUN: mv %t/modulemap %t/modulemap.moved22// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s23// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s24// RUN: rm %t/other.modulemap25// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s26// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s27// RUN: sleep 128// RUN: touch %t/a.h29// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s30// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s31// RUN: rm %t/b.h32// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s33// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/b.pcm %s34// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -DERRORS 2>&1 | FileCheck %s --check-prefix=MISSING-B35// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm -fmodule-map-file=%t/modulemap.moved %s36// RUN: not %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm -fmodule-map-file=%t/modulemap.moved -std=c++1z %s37// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm -fmodule-map-file=%t/modulemap.moved -std=c++1z -Wno-module-file-config-mismatch %s -Db=a38// RUN: rm %t/a.h39// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/a.pcm %s -verify40// RUN: %clang_cc1 -fmodules -I %t -fmodule-file=%t/b.pcm %s -verify41 42// Oftentimes on Windows there are open handles, and deletion will fail.43// REQUIRES: can-remove-opened-file44 45#include "a.h" // expected-error {{file not found}}46int x = b;47 48#ifdef ERRORS49int y = a2<int>;50// CHECK: In module 'a':51// CHECK-NEXT: a.h:1:45: error:52 53int z = b<int>;54// MISSING-B: could not find file '{{.*}}b.h'55// MISSING-B-NOT: please delete the module cache56#endif57 58// RUN: not %clang_cc1 -fmodules -I %t -emit-module -fmodule-name=a -x c++ /dev/null -o %t/c.pcm \59// RUN: -fmodules-embed-file=%t/does-not-exist 2>&1 | FileCheck %s --check-prefix=MISSING-EMBED60// MISSING-EMBED: fatal error: file '{{.*}}does-not-exist' specified by '-fmodules-embed-file=' not found61