aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorMartin Boehme <mboehme@google.com>2020-05-29 10:36:19 +0200
committerMartin Boehme <mboehme@google.com>2020-06-04 08:33:39 +0200
commit8d74de9de6d6cca552d7de7d0bfd36b6dd7d58dc (patch)
tree4bb52720c7e591d077fa5494a0c47cfe1b687b7c /clang/lib/Lex/ModuleMap.cpp
parentb3cff3c72092e40df12a55535a4d0d10cd1d62ce (diff)
downloadllvm-8d74de9de6d6cca552d7de7d0bfd36b6dd7d58dc.zip
llvm-8d74de9de6d6cca552d7de7d0bfd36b6dd7d58dc.tar.gz
llvm-8d74de9de6d6cca552d7de7d0bfd36b6dd7d58dc.tar.bz2
[clang] Always allow including builtin headers in [no_undeclared_headers] modules.
Previously, this would fail if the builtin headers had been "claimed" by a different module that wraps these builtin headers. libc++ does this, for example. This change adds a test demonstrating this situation; the test fails without the fix.
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 85bf93a..bcdc5b8 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -387,13 +387,17 @@ bool ModuleMap::isBuiltinHeader(StringRef FileName) {
.Default(false);
}
+bool ModuleMap::isBuiltinHeader(const FileEntry *File) {
+ return File->getDir() == BuiltinIncludeDir &&
+ ModuleMap::isBuiltinHeader(llvm::sys::path::filename(File->getName()));
+}
+
ModuleMap::HeadersMap::iterator
ModuleMap::findKnownHeader(const FileEntry *File) {
resolveHeaderDirectives(File);
HeadersMap::iterator Known = Headers.find(File);
if (HeaderInfo.getHeaderSearchOpts().ImplicitModuleMaps &&
- Known == Headers.end() && File->getDir() == BuiltinIncludeDir &&
- ModuleMap::isBuiltinHeader(llvm::sys::path::filename(File->getName()))) {
+ Known == Headers.end() && ModuleMap::isBuiltinHeader(File)) {
HeaderInfo.loadTopLevelSystemModules();
return Headers.find(File);
}