summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Lex/HeaderSearch.cpp2
-rw-r--r--clang/test/Modules/Inputs/import-textual/x.h6
-rw-r--r--clang/test/Modules/import-textual-nomodules.m8
3 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index 1ebcc0a1c65..4b5df8c1cc6 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -1143,7 +1143,7 @@ bool HeaderSearch::ShouldEnterIncludeFile(Preprocessor &PP,
// headers find in the wild might rely only on #import and do not contain
// controlling macros, be conservative and only try to enter textual headers
// if such macro is present.
- if (!FileInfo.isModuleHeader &&
+ if (FileInfo.isCompilingModuleHeader && !FileInfo.isModuleHeader &&
FileInfo.getControllingMacro(ExternalLookup))
TryEnterHdr = true;
return TryEnterHdr;
diff --git a/clang/test/Modules/Inputs/import-textual/x.h b/clang/test/Modules/Inputs/import-textual/x.h
new file mode 100644
index 00000000000..9b41ccd0bdc
--- /dev/null
+++ b/clang/test/Modules/Inputs/import-textual/x.h
@@ -0,0 +1,6 @@
+#ifndef RANDOM_DEP
+
+@interface X
+@end
+
+#endif // RANDOM_DEP
diff --git a/clang/test/Modules/import-textual-nomodules.m b/clang/test/Modules/import-textual-nomodules.m
new file mode 100644
index 00000000000..7cf8c1e186d
--- /dev/null
+++ b/clang/test/Modules/import-textual-nomodules.m
@@ -0,0 +1,8 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps -I%S/Inputs/import-textual -fmodules-cache-path=%t %s -verify
+
+// expected-no-diagnostics
+
+#import "x.h"
+#import "x.h"
+
OpenPOWER on IntegriCloud