diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-05-31 20:56:55 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-05-31 20:56:55 +0000 |
commit | 62955aa44343371b203bc2103cad2f75fd91622c (patch) | |
tree | 8ebde701c4746d4422d6737e9e41d6f3cd138920 /test/Modules | |
parent | b2e94d3c82a2c5b4a31ea51c1211abd54b3a7569 (diff) |
[modules] When compiling a preprocessed module map, look for headers relative
to the original module map.
Also use the path and name of the original module map when emitting that
information into the .pcm file. The upshot of this is that the produced .pcm
file will track information for headers in their original locations (where the
module was preprocessed), not relative to whatever directory the preprocessed
module map was in when it was built.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304346 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Modules')
-rw-r--r-- | test/Modules/preprocess-module.cpp | 10 | ||||
-rw-r--r-- | test/Modules/preprocess-nested.cpp | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/test/Modules/preprocess-module.cpp b/test/Modules/preprocess-module.cpp index eaab313693..9d1a2bb680 100644 --- a/test/Modules/preprocess-module.cpp +++ b/test/Modules/preprocess-module.cpp @@ -14,8 +14,6 @@ // RUN: FileCheck %s --input-file %t/rewrite.ii --check-prefix=CHECK --check-prefix=REWRITE // Check that we can build a module from the preprocessed output. -// FIXME: For now, we need the headers to exist. -// RUN: touch %t/file.h %t/file2.h // RUN: %clang_cc1 -fmodules -fmodule-name=file -fmodule-file=%t/fwd.pcm -x c++-module-map-cpp-output %t/no-rewrite.ii -emit-module -o %t/no-rewrite.pcm // RUN: %clang_cc1 -fmodules -fmodule-name=file -fmodule-file=%t/fwd.pcm -x c++-module-map-cpp-output %t/rewrite.ii -emit-module -o %t/rewrite.pcm @@ -27,6 +25,8 @@ // Check the module we built works. // RUN: %clang_cc1 -fmodules -fmodule-file=%t/no-rewrite.pcm %s -I%t -verify -fno-modules-error-recovery // RUN: %clang_cc1 -fmodules -fmodule-file=%t/rewrite.pcm %s -I%t -verify -fno-modules-error-recovery -DREWRITE +// RUN: %clang_cc1 -fmodules -fmodule-file=%t/no-rewrite.pcm %s -I%t -verify -fno-modules-error-recovery -DINCLUDE -I%S/Inputs/preprocess +// RUN: %clang_cc1 -fmodules -fmodule-file=%t/rewrite.pcm %s -I%t -verify -fno-modules-error-recovery -DREWRITE -DINCLUDE -I%S/Inputs/preprocess // == module map @@ -102,7 +102,11 @@ __FILE *a; // expected-error {{declaration of '__FILE' must be imported}} // expected-note@no-rewrite.ii:1 {{here}} #endif +#ifdef INCLUDE +#include "file.h" +#else #pragma clang module import file +#endif FILE *b; -int x = file2; +int x = file2; // ok, found in file2.h, even under -DINCLUDE diff --git a/test/Modules/preprocess-nested.cpp b/test/Modules/preprocess-nested.cpp index 8fccf137e9..f26b65507e 100644 --- a/test/Modules/preprocess-nested.cpp +++ b/test/Modules/preprocess-nested.cpp @@ -8,8 +8,6 @@ // RUN: FileCheck %s --input-file %t/rewrite.ii --check-prefix=CHECK --check-prefix=REWRITE // Check that we can build a module from the preprocessed output. -// FIXME: For now, the files need to exist. -// RUN: touch %t/a.h %t/b.h %t/c.h // RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fmodule-name=nested -x c++-module-map-cpp-output %t/no-rewrite.ii -emit-module -o %t/no-rewrite.pcm // RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fmodule-name=nested -x c++-module-map-cpp-output %t/rewrite.ii -emit-module -o %t/rewrite.pcm |