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
21 lines
1015 B
Matlab
21 lines
1015 B
Matlab
// RUN: rm -rf %t-dir
|
|
// RUN: mkdir -p %t-dir
|
|
// RUN: echo '@import test;' > %t-dir/prefix.h
|
|
// RUN: echo 'void foo(void);' > %t-dir/test.h
|
|
// RUN: cp %S/modified-module-dependency.module.map %t-dir/module.map
|
|
|
|
// Precompile prefix.pch.
|
|
// RUN: %clang_cc1 -x objective-c -I %t-dir -fmodules -fmodules-cache-path=%t-dir/cache -fdisable-module-hash -emit-pch %t-dir/prefix.h -o %t-dir/prefix.pch
|
|
|
|
// Modify the dependency.
|
|
// RUN: echo ' ' >> %t-dir/test.h
|
|
|
|
// Run and check the diagnostics.
|
|
// RUN: not %clang_cc1 -x objective-c -I %t-dir -include-pch %t-dir/prefix.pch -fmodules -fmodules-cache-path=%t-dir/cache -fdisable-module-hash -fsyntax-only %s 2> %t-dir/log
|
|
// RUN: FileCheck %s < %t-dir/log
|
|
|
|
// CHECK: file '[[TEST_H:.*[/\\]test\.h]]' has been modified since the precompiled header '[[PREFIX_PCH:.*/prefix\.pch]]' was built
|
|
// CHECK: '[[TEST_H]]' required by '[[TEST_PCM:.*[/\\]test\.pcm]]'
|
|
// CHECK: '[[TEST_PCM]]' required by '[[PREFIX_PCH]]'
|
|
// CHECK: please rebuild precompiled header '[[PREFIX_PCH]]'
|