[PATCH] D35678: Omit sumbodule semantics for TS modules

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 3 12:40:10 PDT 2017


rsmith added a comment.

This will need a test case.



================
Comment at: lib/Frontend/CompilerInstance.cpp:1598-1612
+  // FIXME: Should we be deciding whether this is a submodule (here and
+  // below) based on -fmodules-ts or should we pass a flag and make the
+  // caller decide?
+  std::string ModuleName;
+  if (getLangOpts().ModulesTS) {
+    // FIXME: Same code as Sema::ActOnModuleDecl() so there is probably a
+    // better place/way to do this.
----------------
The strategy we've been using so far is this: components after the first in a module path name submodules (visibility groups within a module). Modules TS modules use only the first name component, which may contain periods if the module name contains periods.

So the burden should be on the code that produces a `ModuleIdPath` to do this flattening, not on consumers of the `ModuleIdPath`.

(FWIW, I think we may want to consider this later, so that `import foo.bar;` could import either the Modules TS module `foo.bar`, or the submodule `bar` of the module map module `foo`, but that will take some fundamental restructuring of how we model `Module` objects and their hierarchy.)


https://reviews.llvm.org/D35678





More information about the cfe-commits mailing list