]> granicus.if.org Git - clang/commitdiff
When we have an umbrella directory in a module map, recursively walk
authorDouglas Gregor <dgregor@apple.com>
Mon, 12 Dec 2011 19:13:53 +0000 (19:13 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 12 Dec 2011 19:13:53 +0000 (19:13 +0000)
the subdirectories to find headers in submodules.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146398 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/FrontendActions.cpp
test/Modules/Inputs/NoUmbrella.framework/Headers/SubDir/C.h [new file with mode: 0644]
test/Modules/auto-module-import.m

index 5dabe819963329bddbb6e9afac32a41f636e00bf..a97a32ba0676d70d1de3a1efa2efbd88cc390a10 100644 (file)
@@ -161,7 +161,8 @@ static void collectModuleHeaderIncludes(const LangOptions &LangOpts,
     llvm::error_code EC;
     llvm::SmallString<128> DirNative;
     llvm::sys::path::native(UmbrellaDir->getName(), DirNative);
-    for (llvm::sys::fs::directory_iterator Dir(DirNative.str(), EC), DirEnd;
+    for (llvm::sys::fs::recursive_directory_iterator Dir(DirNative.str(), EC), 
+                                                     DirEnd;
          Dir != DirEnd && !EC; Dir.increment(EC)) {
       // Check whether this entry has an extension typically associated with 
       // headers.
diff --git a/test/Modules/Inputs/NoUmbrella.framework/Headers/SubDir/C.h b/test/Modules/Inputs/NoUmbrella.framework/Headers/SubDir/C.h
new file mode 100644 (file)
index 0000000..4a9351a
--- /dev/null
@@ -0,0 +1 @@
+int no_umbrella_C;
index d59099f5de11d607a0f405a165f17b73009f9705..21e79687610c931c2cf88fbe29fe1bf00af565fc 100644 (file)
@@ -28,6 +28,10 @@ void testSubframeworkOther() {
 #include <NoUmbrella/A.h> // expected-warning{{treating #include as an import of module 'NoUmbrella.A'}}
 int getNoUmbrellaA() { return no_umbrella_A; } 
 
+// Test umbrella-less submodule includes
+#include <NoUmbrella/SubDir/C.h> // expected-warning{{treating #include as an import of module 'NoUmbrella.SubDir.C'}}
+int getNoUmbrellaC() { return no_umbrella_C; } 
+
 // Test header cross-subframework include pattern.
 #include <DependsOnModule/../Frameworks/SubFramework.framework/Headers/Other.h> // expected-warning{{treating #include as an import of module 'DependsOnModule.SubFramework.Other'}}