aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/HeaderSearch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Lex/HeaderSearch.cpp')
-rw-r--r--clang/lib/Lex/HeaderSearch.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index 60fd42bc1127..219c62663ebd 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -398,10 +398,11 @@ StringRef DirectoryLookup::getName() const {
Optional<FileEntryRef> HeaderSearch::getFileAndSuggestModule(
StringRef FileName, SourceLocation IncludeLoc, const DirectoryEntry *Dir,
bool IsSystemHeaderDir, Module *RequestingModule,
- ModuleMap::KnownHeader *SuggestedModule) {
+ ModuleMap::KnownHeader *SuggestedModule, bool OpenFile /*=true*/,
+ bool CacheFailures /*=true*/) {
// If we have a module map that might map this header, load it and
// check whether we'll have a suggestion for a module.
- auto File = getFileMgr().getFileRef(FileName, /*OpenFile=*/true);
+ auto File = getFileMgr().getFileRef(FileName, OpenFile, CacheFailures);
if (!File) {
// For rare, surprising errors (e.g. "out of file handles"), diag the EC
// message.
@@ -431,7 +432,8 @@ Optional<FileEntryRef> DirectoryLookup::LookupFile(
SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath,
Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule,
bool &InUserSpecifiedSystemFramework, bool &IsFrameworkFound,
- bool &IsInHeaderMap, SmallVectorImpl<char> &MappedName) const {
+ bool &IsInHeaderMap, SmallVectorImpl<char> &MappedName,
+ bool OpenFile) const {
InUserSpecifiedSystemFramework = false;
IsInHeaderMap = false;
MappedName.clear();
@@ -451,9 +453,9 @@ Optional<FileEntryRef> DirectoryLookup::LookupFile(
RelativePath->append(Filename.begin(), Filename.end());
}
- return HS.getFileAndSuggestModule(TmpDir, IncludeLoc, getDir(),
- isSystemHeaderDirectory(),
- RequestingModule, SuggestedModule);
+ return HS.getFileAndSuggestModule(
+ TmpDir, IncludeLoc, getDir(), isSystemHeaderDirectory(),
+ RequestingModule, SuggestedModule, OpenFile);
}
if (isFramework())
@@ -491,7 +493,7 @@ Optional<FileEntryRef> DirectoryLookup::LookupFile(
Dest = HM->lookupFilename(Filename, Path);
}
- if (auto Res = HS.getFileMgr().getOptionalFileRef(Dest)) {
+ if (auto Res = HS.getFileMgr().getOptionalFileRef(Dest, OpenFile)) {
FixupSearchPath();
return *Res;
}
@@ -840,7 +842,7 @@ Optional<FileEntryRef> HeaderSearch::LookupFile(
SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath,
Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule,
bool *IsMapped, bool *IsFrameworkFound, bool SkipCache,
- bool BuildSystemModule) {
+ bool BuildSystemModule, bool OpenFile, bool CacheFailures) {
ConstSearchDirIterator CurDirLocal = nullptr;
ConstSearchDirIterator &CurDir = CurDirArg ? *CurDirArg : CurDirLocal;
@@ -869,8 +871,9 @@ Optional<FileEntryRef> HeaderSearch::LookupFile(
}
// Otherwise, just return the file.
return getFileAndSuggestModule(Filename, IncludeLoc, nullptr,
- /*IsSystemHeaderDir*/false,
- RequestingModule, SuggestedModule);
+ /*IsSystemHeaderDir*/ false,
+ RequestingModule, SuggestedModule, OpenFile,
+ CacheFailures);
}
// This is the header that MSVC's header search would have found.
@@ -1010,7 +1013,7 @@ Optional<FileEntryRef> HeaderSearch::LookupFile(
Optional<FileEntryRef> File = It->LookupFile(
Filename, *this, IncludeLoc, SearchPath, RelativePath, RequestingModule,
SuggestedModule, InUserSpecifiedSystemFramework, IsFrameworkFoundInDir,
- IsInHeaderMap, MappedName);
+ IsInHeaderMap, MappedName, OpenFile);
if (!MappedName.empty()) {
assert(IsInHeaderMap && "MappedName should come from a header map");
CacheLookup.MappedName =