[PATCH] D40443: [Modules TS] Make imports from an interface unit visible to its implementation units
Hamza Sood via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 28 07:10:00 PST 2017
hamzasood added inline comments.
Comment at: lib/Basic/Module.cpp:349
+ // Everything visible to the interface unit's global module fragment is
+ // visible to the interface unit.
> This comment (not sure about the code) sounds wrong to me: names from the interface unit before the module purview (I assume this is what "global module fragment" refers to) should not be visible in the implementation units.
Yes, the documentation comment for this function (in the header) notes that things visible to the interface unit aren’t necessarily visible to the implementation units.
There’re a few reasons why I chose for the function to count modules that’re only visible from the interface unit:
# The `Module::Kind` for a C++ module is `ModuleInterfaceUnit`. Since the module identifies itself as an interface unit, I figured it’d make sense for queries such as this to return what’s relevant for the interface unit.
# I think it’s just more useful that way. I can’t think of any situation where a module would need to know what’s visible to implementation units of other modules (and I couldn’t find any such examples in Clang). However there’re plenty of reasons why one would want to know about visibility to an interface unit (synthesising default members, instantiating templates etc.)
More information about the cfe-commits