
To differentiate between two modules with the same name, we will consider the path the module map file that they are defined by* part of the ‘key’ for looking up the precompiled module (pcm file). Specifically, this patch renames the precompiled module (pcm) files from cache-path/<module hash>/Foo.pcm to cache-path/<module hash>/Foo-<hash of module map path>.pcm In addition, I’ve taught the ASTReader to re-resolve the names of imported modules during module loading so that if the header search context changes between when a module was originally built and when it is loaded we can rebuild it if necessary. For example, if module A imports module B first time: clang -I /path/to/A -I /path/to/B ... second time: clang -I /path/to/A -I /different/path/to/B ... will now rebuild A as expected. * in the case of inferred modules, we use the module map file that allowed the inference, not the __inferred_module.map file, since the inferred file path is the same for every inferred module. llvm-svn: 206201
36 lines
1.6 KiB
Objective-C
36 lines
1.6 KiB
Objective-C
// REQUIRES: shell
|
|
// RUN: rm -rf %t
|
|
|
|
// A from path 1
|
|
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/path1/A -DDIRECT -DEXPECTED_PATH=1
|
|
|
|
// A from path 2
|
|
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/path2/A -DDIRECT -DEXPECTED_PATH=2
|
|
|
|
// Confirm that we have two pcm files (one for each 'A').
|
|
// RUN: find %t -name "A-*.pcm" | count 2
|
|
|
|
// DependsOnA, using A from path 1
|
|
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -DEXPECTED_PATH=1
|
|
|
|
// Confirm that we have three pcm files (one for each 'A', and one for 'DependsOnA')
|
|
// RUN: find %t -name "*.pcm" | count 3
|
|
|
|
// DependsOnA, using A from path 2
|
|
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path2/A -DEXPECTED_PATH=2
|
|
|
|
// Confirm that we still have three pcm files, since DependsOnA will be rebuilt
|
|
// RUN: find %t -name "*.pcm" | count 3
|
|
|
|
#ifdef DIRECT
|
|
@import A;
|
|
#else
|
|
@import DependsOnA;
|
|
#endif
|
|
|
|
#if FROM_PATH != EXPECTED_PATH
|
|
#error "Got the wrong module!"
|
|
#endif
|
|
|
|
// expected-no-diagnostics
|