[PATCH] Allow multiple modules with the same name to coexist in the module cache

Ben Langmuir blangmuir at apple.com
Fri Mar 28 13:12:12 PDT 2014


This patch allows multiple modules that have the same name to coexist in the module cache.  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.

Ben

-------------- next part --------------
A non-text attachment was scrubbed...
Name: modulemappath.patch
Type: application/octet-stream
Size: 47204 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140328/f2068f33/attachment.obj>


More information about the cfe-commits mailing list