[PATCH] Module use declarations (II)

Daniel Jasper djasper at google.com
Thu Sep 5 08:23:11 PDT 2013



================
Comment at: docs/Modules.rst:195
@@ +194,3 @@
+``-fmodules-source-for=module-id``
+  Consider a source file as a part of the given module.
+
----------------
Doug Gregor wrote:
> How is this different from -fmodule-name=module-id?
I don't know. Maybe Lawrence missed that because it is an undocumented (here) cc1 option? Removed.

Documented -fmodule-name instead.

Also, this showed that one of the tests was entirely broken :).

================
Comment at: docs/Modules.rst:198
@@ +197,3 @@
+``-fmodules-indirect-check``
+  Extend checking of module imports and includes to indirect uses of modules.
+
----------------
Doug Gregor wrote:
> I wonder... do we have to have this as an option, or can we simply say that there is one right answer and implement only that?
We can try without. I think only direct checking makes sense at the moment. Everything else was untested anyway ..

================
Comment at: lib/Basic/Module.cpp:271
@@ +270,3 @@
+  }
+  // FIXME: Add handling of wildcard module specifications.
+}
----------------
Doug Gregor wrote:
> Why do we even have wildcards for uses? It seems that one would have to enumerate all of the uses separately for this feature to be useful.
I had the same initial thought. However, I think this might be useful e.g. because a project's internal modules might be treated differently from system modules. Internally, a project might want to specify all dependencies clearly. However, it could e.g. be useful to say "uses std.*" because including any header from std is always ok. (I don't feel certain about this, though).

================
Comment at: lib/Lex/PPDirectives.cpp:613
@@ +612,3 @@
+      violatesUseDeclarations(RequestingModule, RequestedModule))
+    Diag(FilenameLoc, diag::error_undeclared_use_of_module)
+        << Filename;
----------------
Doug Gregor wrote:
> I guess we don't get Fix-Its within module map files... or do we?
I don't think so. Added FIXME.

================
Comment at: include/clang/Basic/LangOptions.h:84
@@ +83,3 @@
+  /// \brief The module for which the translation unit is a source.
+  std::string ModuleSourceFor;
+
----------------
Doug Gregor wrote:
> We have LangOptions::CurrentModule, set by -fmodule-name=<name>. Is this so different that we need a separate value/option?
Using CurrentModule now.

================
Comment at: lib/Serialization/ASTReader.cpp:3032
@@ -3031,1 +3031,3 @@
+
+  //FIXME: How do we load the 'use'd modules?  They may not be submodules.
   
----------------
Doug Gregor wrote:
> You can read/write global "submodule IDs". The "sub" is misleading in this case; it means that one might be referring to either a top-level module or to a submodule.
I don't understand where the ID of a global module would come from. As far as I understand, all the (sub)modules within a single top-level module are numbered and then referred to by this number. How would that work for global modules?


http://llvm-reviews.chandlerc.com/D1546



More information about the cfe-commits mailing list