[Modules] Allow modules specified by -fmodule-map-file to shadow implicitly…

Authored by bruno on Jan 3 2018, 6:17 PM.


[Modules] Allow modules specified by -fmodule-map-file to shadow implicitly found ones

When modules come from module map files explicitly specified by
-fmodule-map-file= arguments, allow those to override/shadow modules
with the same name that are found implicitly by header search. If such a
module is looked up by name (e.g. @import), we will always find the one
from -fmodule-map-file. If we try to use a shadowed module by including
one of its headers report an error.

This enables developers to force use of a specific copy of their module
to be used if there are multiple copies that would otherwise be visible,
for example if they develop modules that are installed in the default
search paths.

Patch originally by Ben Langmuir,

Based on cfe-dev discussion:

Differential Revision: https://reviews.llvm.org/D31269


llvm-svn: 321781