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

Richard Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 9 10:32:01 PDT 2017


rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

This makes a lot of sense to me. See also r302463: I think we probably want three levels of shadowing here: the main input shadows -fmodule-map-file, which shadows module maps loaded implicitly. (There's also a question of what we do with module map information loaded from an AST file: currently when that happens, we ignore the tokens for the parsed module map entirely. 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.)



================
Comment at: lib/Lex/ModuleMap.cpp:2574-2575
 
+  llvm::SaveAndRestore<bool> OldExplicit(CurrentModuleMapIsExplicitlyProvided);
+  CurrentModuleMapIsExplicitlyProvided |= IsExplicitlyProvided;
+
----------------
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?


https://reviews.llvm.org/D31269





More information about the cfe-commits mailing list