[clang] f43ce51 - [clang][lex] NFCI: Use DirectoryEntryRef in FrameworkCacheEntry
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 20 10:01:36 PDT 2022
Author: Jan Svoboda
Date: 2022-04-20T19:01:02+02:00
New Revision: f43ce5199df328c0acd3bc1d56d481b22d681ca8
URL: https://github.com/llvm/llvm-project/commit/f43ce5199df328c0acd3bc1d56d481b22d681ca8
DIFF: https://github.com/llvm/llvm-project/commit/f43ce5199df328c0acd3bc1d56d481b22d681ca8.diff
LOG: [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
Added:
Modified:
clang/include/clang/Lex/HeaderSearch.h
clang/lib/Lex/HeaderSearch.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Lex/HeaderSearch.h b/clang/include/clang/Lex/HeaderSearch.h
index ce96575a3829c..2f2225e93397b 100644
--- a/clang/include/clang/Lex/HeaderSearch.h
+++ b/clang/include/clang/Lex/HeaderSearch.h
@@ -155,7 +155,7 @@ class ExternalHeaderFileInfoSource {
/// This structure is used to record entries in our framework cache.
struct FrameworkCacheEntry {
/// The directory entry which should be used for the cached framework.
- const DirectoryEntry *Directory;
+ Optional<DirectoryEntryRef> Directory;
/// Whether this framework has been "user-specified" to be treated as if it
/// were a system framework (even if it was found outside a system framework
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp
index bc5dfae6e10ac..d53a3601ba7a8 100644
--- a/clang/lib/Lex/HeaderSearch.cpp
+++ b/clang/lib/Lex/HeaderSearch.cpp
@@ -582,7 +582,7 @@ Optional<FileEntryRef> DirectoryLookup::DoFrameworkLookup(
HS.LookupFrameworkCache(Filename.substr(0, SlashPos));
// If it is known and in some other directory, fail.
- if (CacheEntry.Directory && CacheEntry.Directory != getFrameworkDir())
+ if (CacheEntry.Directory && CacheEntry.Directory != getFrameworkDirRef())
return None;
// Otherwise, construct the path to this framework dir.
@@ -611,7 +611,7 @@ Optional<FileEntryRef> DirectoryLookup::DoFrameworkLookup(
// Otherwise, if it does, remember that this is the right direntry for this
// framework.
- CacheEntry.Directory = getFrameworkDir();
+ CacheEntry.Directory = getFrameworkDirRef();
// If this is a user search directory, check if the framework has been
// user-specified as a system framework.
@@ -626,7 +626,7 @@ Optional<FileEntryRef> DirectoryLookup::DoFrameworkLookup(
// Set out flags.
InUserSpecifiedSystemFramework = CacheEntry.IsUserSpecifiedSystemFramework;
- IsFrameworkFound = CacheEntry.Directory;
+ IsFrameworkFound = CacheEntry.Directory.hasValue();
if (RelativePath) {
RelativePath->clear();
@@ -1184,13 +1184,13 @@ Optional<FileEntryRef> HeaderSearch::LookupSubframeworkHeader(
++NumSubFrameworkLookups;
// If the framework dir doesn't exist, we fail.
- auto Dir = FileMgr.getDirectory(FrameworkName);
+ auto Dir = FileMgr.getOptionalDirectoryRef(FrameworkName);
if (!Dir)
return None;
// Otherwise, if it does, remember that this is the right direntry for this
// framework.
- CacheLookup.second.Directory = *Dir;
+ CacheLookup.second.Directory = Dir;
}
More information about the cfe-commits
mailing list