[PATCH] D48367: [modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts
Yuka Takahashi via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 25 04:55:46 PDT 2018
yamaguchi updated this revision to Diff 152664.
yamaguchi added a comment.
use %clang_cc1 instead of %clang
https://reviews.llvm.org/D48367
Files:
clang/include/clang/Lex/ModuleMap.h
clang/lib/Lex/HeaderSearch.cpp
clang/test/Modules/Inputs/autoload-subdirectory/a.h
clang/test/Modules/Inputs/autoload-subdirectory/b.h
clang/test/Modules/Inputs/autoload-subdirectory/include/module.modulemap
clang/test/Modules/Inputs/autoload-subdirectory/module.modulemap
clang/test/Modules/autoload-subdirectory.cpp
Index: clang/test/Modules/autoload-subdirectory.cpp
===================================================================
--- /dev/null
+++ clang/test/Modules/autoload-subdirectory.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fmodules -fmodule-name=Foo -I %S/Inputs/autoload-subdirectory/ %s -verify
+// expected-no-diagnostics
+
+#include "a.h"
+
+int main() {
+ foo neko;
+ return 0;
+}
Index: clang/test/Modules/Inputs/autoload-subdirectory/module.modulemap
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/autoload-subdirectory/module.modulemap
@@ -0,0 +1,2 @@
+module a { header "a.h" }
+module b { header "b.h" }
Index: clang/test/Modules/Inputs/autoload-subdirectory/include/module.modulemap
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/autoload-subdirectory/include/module.modulemap
@@ -0,0 +1,2 @@
+module a { header "a.h" }
+module b { header "b.h" }
Index: clang/test/Modules/Inputs/autoload-subdirectory/b.h
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/autoload-subdirectory/b.h
@@ -0,0 +1 @@
+class bar {};
Index: clang/test/Modules/Inputs/autoload-subdirectory/a.h
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/autoload-subdirectory/a.h
@@ -0,0 +1,8 @@
+#include "b.h"
+
+class foo {
+ int x,y;
+ public:
+ foo() {};
+ ~foo() {};
+};
Index: clang/lib/Lex/HeaderSearch.cpp
===================================================================
--- clang/lib/Lex/HeaderSearch.cpp
+++ clang/lib/Lex/HeaderSearch.cpp
@@ -282,7 +282,8 @@
// Load all module maps in the immediate subdirectories of this search
// directory.
- loadSubdirectoryModuleMaps(SearchDirs[Idx]);
+ if (ModMap.getLangOpts().ObjC1 || ModMap.getLangOpts().ObjC2)
+ loadSubdirectoryModuleMaps(SearchDirs[Idx]);
// Look again for the module.
Module = ModMap.findModule(ModuleName);
Index: clang/include/clang/Lex/ModuleMap.h
===================================================================
--- clang/include/clang/Lex/ModuleMap.h
+++ clang/include/clang/Lex/ModuleMap.h
@@ -110,6 +110,11 @@
llvm::StringMap<llvm::StringSet<>> PendingLinkAsModule;
public:
+ /// Get LangOpts of ModuleMap
+ const LangOptions& getLangOpts() {
+ return LangOpts;
+ }
+
/// Use PendingLinkAsModule information to mark top level link names that
/// are going to be replaced by export_as aliases.
void resolveLinkAsDependencies(Module *Mod);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48367.152664.patch
Type: text/x-patch
Size: 2620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180625/49d36d37/attachment-0001.bin>
More information about the cfe-commits
mailing list