]> granicus.if.org Git - clang/commit
Reapply r321781: [Modules] Allow modules specified by -fmodule-map-file to shadow...
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 5 Jan 2018 02:33:18 +0000 (02:33 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 5 Jan 2018 02:33:18 +0000 (02:33 +0000)
commit0b1c4572180545492c8054f21904e38bc3e5f575
treeed7f670972811ad82cb062662c41ebf7e2ddafb7
parent30940fe1ee6e7de897e4f8353561e1fe41a0e3e9
Reapply r321781: [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,
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20151116/143425.html

Based on cfe-dev discussion:
http://lists.llvm.org/pipermail/cfe-dev/2015-November/046164.html

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

rdar://problem/23612102

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321855 91177308-0d34-0410-b5e6-96231b3b80d8
23 files changed:
include/clang/Basic/DiagnosticCommonKinds.td
include/clang/Basic/Module.h
include/clang/Lex/HeaderSearch.h
include/clang/Lex/ModuleMap.h
lib/Basic/Module.cpp
lib/Lex/HeaderSearch.cpp
lib/Lex/ModuleMap.cpp
lib/Lex/PPDirectives.cpp
test/Modules/Inputs/shadow/A1/A.h [new file with mode: 0644]
test/Modules/Inputs/shadow/A1/module.modulemap [new file with mode: 0644]
test/Modules/Inputs/shadow/A2/A.h [new file with mode: 0644]
test/Modules/Inputs/shadow/A2/module.modulemap [new file with mode: 0644]
test/Modules/Inputs/shadowed-submodule/A1/Foo.h [new file with mode: 0644]
test/Modules/Inputs/shadowed-submodule/A1/module.modulemap [new file with mode: 0644]
test/Modules/Inputs/shadowed-submodule/A1/sys/A.h [new file with mode: 0644]
test/Modules/Inputs/shadowed-submodule/A1/sys/A2.h [new file with mode: 0644]
test/Modules/Inputs/shadowed-submodule/A2/Foo.h [new file with mode: 0644]
test/Modules/Inputs/shadowed-submodule/A2/module.modulemap [new file with mode: 0644]
test/Modules/Inputs/shadowed-submodule/A2/sys/A.h [new file with mode: 0644]
test/Modules/Inputs/shadowed-submodule/A2/sys/A2.h [new file with mode: 0644]
test/Modules/Inputs/shadowed-submodule/Foo/module.modulemap [new file with mode: 0644]
test/Modules/shadow.m [new file with mode: 0644]
test/Modules/shadowed-submodule.m [new file with mode: 0644]