diff options
author | David Goldman <davg@google.com> | 2022-01-20 13:41:56 -0500 |
---|---|---|
committer | David Goldman <davg@google.com> | 2022-02-04 13:32:39 -0500 |
commit | 9385ece95a4a342ca4f4c46ea747f79d4ede9783 (patch) | |
tree | 0263627d29ddeae4d092c35837ece319abc370d6 /clang/lib/Lex/HeaderSearch.cpp | |
parent | 012c811fed44da85f9870df9accf4477e626a012 (diff) | |
download | llvm-9385ece95a4a342ca4f4c46ea747f79d4ede9783.zip llvm-9385ece95a4a342ca4f4c46ea747f79d4ede9783.tar.gz llvm-9385ece95a4a342ca4f4c46ea747f79d4ede9783.tar.bz2 |
[HeaderSearch] Track framework name in LookupFile
Previously, the Framework name was only set if the file
came from a header mapped framework; now we'll always
set the framework name if the file is in a framework.
Differential Revision: https://reviews.llvm.org/D117830
Diffstat (limited to 'clang/lib/Lex/HeaderSearch.cpp')
-rw-r--r-- | clang/lib/Lex/HeaderSearch.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index 39c125c..19e284f 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -1037,8 +1037,9 @@ Optional<FileEntryRef> HeaderSearch::LookupFile( } } - // If this file is found in a header map and uses the framework style of - // includes, then this header is part of a framework we're building. + // Set the `Framework` info if this file is in a header map with framework + // style include spelling or found in a framework dir. The header map case + // is possible when building frameworks which use header maps. if (CurDir->isHeaderMap() && isAngled) { size_t SlashPos = Filename.find('/'); if (SlashPos != StringRef::npos) @@ -1046,6 +1047,11 @@ Optional<FileEntryRef> HeaderSearch::LookupFile( getUniqueFrameworkName(StringRef(Filename.begin(), SlashPos)); if (CurDir->isIndexHeaderMap()) HFI.IndexHeaderMapHeader = 1; + } else if (CurDir->isFramework()) { + size_t SlashPos = Filename.find('/'); + if (SlashPos != StringRef::npos) + HFI.Framework = + getUniqueFrameworkName(StringRef(Filename.begin(), SlashPos)); } if (checkMSVCHeaderSearch(Diags, MSFE ? &MSFE->getFileEntry() : nullptr, |