diff options
author | Richard Howell <rmaz@users.noreply.github.com> | 2023-10-27 07:10:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-27 07:10:46 -0700 |
commit | 396b5621f94ca6fc4d86d4fb0e33e9e51a86affd (patch) | |
tree | 8816bc6adca58164165a25a72856b1d69dedb880 /clang/lib/Lex/ModuleMap.cpp | |
parent | e9478b167f2a0f3999676946c2c4a13e30014cfe (diff) | |
download | llvm-396b5621f94ca6fc4d86d4fb0e33e9e51a86affd.zip llvm-396b5621f94ca6fc4d86d4fb0e33e9e51a86affd.tar.gz llvm-396b5621f94ca6fc4d86d4fb0e33e9e51a86affd.tar.bz2 |
[clang] use relative paths for builtin headers during module compilation (#68023)
When including builtin headers as part of a system module, ensure we use
relative paths to those headers. Otherwise the module will fail to compile
when specifying relative resource directories without extra search paths.
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r-- | clang/lib/Lex/ModuleMap.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index eb7cab5..e4f3cdd 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -348,8 +348,8 @@ bool ModuleMap::resolveAsBuiltinHeader( if (!File) return false; + Module::Header H = {Header.FileName, Header.FileName, *File}; auto Role = headerKindToRole(Header.Kind); - Module::Header H = {Header.FileName, std::string(Path.str()), *File}; addHeader(Mod, H, Role); return true; } @@ -417,6 +417,13 @@ bool ModuleMap::isBuiltinHeader(FileEntryRef File) { isBuiltinHeaderName(llvm::sys::path::filename(File.getName())); } +bool ModuleMap::shouldImportRelativeToBuiltinIncludeDir(StringRef FileName, + Module *Module) const { + return LangOpts.BuiltinHeadersInSystemModules && BuiltinIncludeDir && + Module->IsSystem && !Module->isPartOfFramework() && + isBuiltinHeaderName(FileName); +} + ModuleMap::HeadersMap::iterator ModuleMap::findKnownHeader(FileEntryRef File) { resolveHeaderDirectives(File); HeadersMap::iterator Known = Headers.find(File); |