[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 Jan 3 18:17:37 PST 2018


bruno added a comment.

> It might make more sense to have the module loaded from the AST file shadow the module from the module map, especially for an explicit module build, now that we have that functionality.)

+1, seems a much more consistent model.



================
Comment at: lib/Lex/ModuleMap.cpp:2574-2575
 
+  llvm::SaveAndRestore<bool> OldExplicit(CurrentModuleMapIsExplicitlyProvided);
+  CurrentModuleMapIsExplicitlyProvided |= IsExplicitlyProvided;
+
----------------
rsmith wrote:
> It would seem cleaner to make this a member of `ModuleMapParser` (and explicitly pass down the flag when parsing an `extern module` declaration). Is there a reason to use (essentially) global state for this?
I don't believe there's any reason for using a global state here (and Ben doesn't recall any specific reason either). I changed the patch to pass down the flag and it works fine.


https://reviews.llvm.org/D31269





More information about the cfe-commits mailing list