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

Bruno Cardoso Lopes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 22 16:39:55 PDT 2017


bruno created this revision.

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.

We're using this internally for a couple years now, it would be nice to have it upstreamed.

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


https://reviews.llvm.org/D31269

Files:
  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/Frontend/CompilerInstance.cpp
  lib/Frontend/FrontendActions.cpp
  lib/Lex/HeaderSearch.cpp
  lib/Lex/ModuleMap.cpp
  lib/Lex/PPDirectives.cpp
  test/Modules/Inputs/shadow/A1/A.h
  test/Modules/Inputs/shadow/A1/module.modulemap
  test/Modules/Inputs/shadow/A2/A.h
  test/Modules/Inputs/shadow/A2/module.modulemap
  test/Modules/shadow.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31269.92738.patch
Type: text/x-patch
Size: 18851 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170322/b5f255be/attachment-0001.bin>


More information about the cfe-commits mailing list