[PATCH] D11403: [Modules] Add Darwin-specific compatibility module map parsing hacks

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 11:36:11 PDT 2015


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

Looks fine, go ahead once you're satisfied that the performance is OK for the `requires excluded` / umbrella dir hack.


================
Comment at: include/clang/Basic/Module.h:363
@@ +362,3 @@
+  /// This is more efficient than getFullModuleName().
+  bool fullModuleNameEqual(ArrayRef<StringRef> nameParts) const;
+
----------------
`fullModuleNameEquals` (extra 's' at the end) or `fullModuleNameIs` maybe?

================
Comment at: lib/Basic/Module.cpp:142-147
@@ +141,8 @@
+bool Module::fullModuleNameEqual(ArrayRef<StringRef> nameParts) const {
+  for (const Module *M = this; M; M = M->Parent) {
+    if (nameParts.empty() || M->Name != nameParts.back())
+      return false;
+    nameParts = nameParts.drop_back();
+  }
+  return nameParts.empty();
+}
----------------
Seems weird to do this by modifying `nameParts` rather than tracking an index, but OK...

================
Comment at: lib/Lex/ModuleMap.cpp:1025-1026
@@ +1024,4 @@
+    /// non-modular headers.  For backwards compatibility, we continue to
+    /// support
+    /// this idiom for just these modules, and map the headers to 'textual' to
+    /// match the original intent.
----------------
Unnecessary newline?

================
Comment at: lib/Lex/ModuleMap.cpp:1607-1608
@@ +1606,4 @@
+                                M->fullModuleNameEqual(TclPrivate))) {
+      IsRequiresExcludedHack = true;
+      return false;
+  } else if (Feature == "cplusplus" && M->fullModuleNameEqual(IOKitAVC)) {
----------------
Overindented.


Repository:
  rL LLVM

http://reviews.llvm.org/D11403





More information about the cfe-commits mailing list