Skip to content

Commit f43ce51

Browse files
committed
[clang][lex] NFCI: Use DirectoryEntryRef in FrameworkCacheEntry
This patch changes the member of `FrameworkCacheEntry` from `const DirectoryEntry *` to `Optional<DirectoryEntryRef>` in order to remove uses of the deprecated `DirectoryEntry::getName()`. Reviewed By: bnbarham Differential Revision: https://reviews.llvm.org/D123854
1 parent ba118f3 commit f43ce51

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

clang/include/clang/Lex/HeaderSearch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class ExternalHeaderFileInfoSource {
155155
/// This structure is used to record entries in our framework cache.
156156
struct FrameworkCacheEntry {
157157
/// The directory entry which should be used for the cached framework.
158-
const DirectoryEntry *Directory;
158+
Optional<DirectoryEntryRef> Directory;
159159

160160
/// Whether this framework has been "user-specified" to be treated as if it
161161
/// were a system framework (even if it was found outside a system framework

clang/lib/Lex/HeaderSearch.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ Optional<FileEntryRef> DirectoryLookup::DoFrameworkLookup(
582582
HS.LookupFrameworkCache(Filename.substr(0, SlashPos));
583583

584584
// If it is known and in some other directory, fail.
585-
if (CacheEntry.Directory && CacheEntry.Directory != getFrameworkDir())
585+
if (CacheEntry.Directory && CacheEntry.Directory != getFrameworkDirRef())
586586
return None;
587587

588588
// Otherwise, construct the path to this framework dir.
@@ -611,7 +611,7 @@ Optional<FileEntryRef> DirectoryLookup::DoFrameworkLookup(
611611

612612
// Otherwise, if it does, remember that this is the right direntry for this
613613
// framework.
614-
CacheEntry.Directory = getFrameworkDir();
614+
CacheEntry.Directory = getFrameworkDirRef();
615615

616616
// If this is a user search directory, check if the framework has been
617617
// user-specified as a system framework.
@@ -626,7 +626,7 @@ Optional<FileEntryRef> DirectoryLookup::DoFrameworkLookup(
626626

627627
// Set out flags.
628628
InUserSpecifiedSystemFramework = CacheEntry.IsUserSpecifiedSystemFramework;
629-
IsFrameworkFound = CacheEntry.Directory;
629+
IsFrameworkFound = CacheEntry.Directory.hasValue();
630630

631631
if (RelativePath) {
632632
RelativePath->clear();
@@ -1184,13 +1184,13 @@ Optional<FileEntryRef> HeaderSearch::LookupSubframeworkHeader(
11841184
++NumSubFrameworkLookups;
11851185

11861186
// If the framework dir doesn't exist, we fail.
1187-
auto Dir = FileMgr.getDirectory(FrameworkName);
1187+
auto Dir = FileMgr.getOptionalDirectoryRef(FrameworkName);
11881188
if (!Dir)
11891189
return None;
11901190

11911191
// Otherwise, if it does, remember that this is the right direntry for this
11921192
// framework.
1193-
CacheLookup.second.Directory = *Dir;
1193+
CacheLookup.second.Directory = Dir;
11941194
}
11951195

11961196

0 commit comments

Comments
 (0)