aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/FileManager.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-12-12 16:03:20 -0800
committerGitHub <noreply@github.com>2024-12-12 16:03:20 -0800
commitd01c11df04ae45a3d5b08e69bb683c760bbddd54 (patch)
tree16a9bbc1c07e839a23d83aa2b046a7316452db06 /clang/lib/Basic/FileManager.cpp
parentea6e13586ce22291e9e7a4e382f6b2409b406da9 (diff)
downloadllvm-d01c11df04ae45a3d5b08e69bb683c760bbddd54.zip
llvm-d01c11df04ae45a3d5b08e69bb683c760bbddd54.tar.gz
llvm-d01c11df04ae45a3d5b08e69bb683c760bbddd54.tar.bz2
[clang] Migrate away from PointerUnion::{is,get} (NFC) (#119724)
Note that PointerUnion::{is,get} have been soft deprecated in PointerUnion.h: // FIXME: Replace the uses of is(), get() and dyn_cast() with // isa<T>, cast<T> and the llvm::dyn_cast<T> I'm not touching PointerUnion::dyn_cast for now because it's a bit complicated; we could blindly migrate it to dyn_cast_if_present, but we should probably use dyn_cast when the operand is known to be non-null.
Diffstat (limited to 'clang/lib/Basic/FileManager.cpp')
-rw-r--r--clang/lib/Basic/FileManager.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index f44b5e4..f0b6f7b 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/lib/Basic/FileManager.cpp
@@ -324,9 +324,9 @@ llvm::Expected<FileEntryRef> FileManager::getFileRef(StringRef Filename,
*SeenFileEntries
.insert({Status.getName(), FileEntryRef::MapValue(*UFE, DirInfo)})
.first;
- assert(Redirection.second->V.is<FileEntry *>() &&
+ assert(isa<FileEntry *>(Redirection.second->V) &&
"filename redirected to a non-canonical filename?");
- assert(Redirection.second->V.get<FileEntry *>() == UFE &&
+ assert(cast<FileEntry *>(Redirection.second->V) == UFE &&
"filename from getStatValue() refers to wrong file");
// Cache the redirection in the previously-inserted entry, still available
@@ -400,7 +400,7 @@ FileEntryRef FileManager::getVirtualFileRef(StringRef Filename, off_t Size,
FileEntryRef::MapValue Value = *NamedFileEnt.second;
if (LLVM_LIKELY(isa<FileEntry *>(Value.V)))
return FileEntryRef(NamedFileEnt);
- return FileEntryRef(*Value.V.get<const FileEntryRef::MapEntry *>());
+ return FileEntryRef(*cast<const FileEntryRef::MapEntry *>(Value.V));
}
// We've not seen this before, or the file is cached as non-existent.
@@ -620,7 +620,7 @@ void FileManager::GetUniqueIDMapping(
for (const auto &Entry : SeenFileEntries) {
// Only return files that exist and are not redirected.
- if (!Entry.getValue() || !Entry.getValue()->V.is<FileEntry *>())
+ if (!Entry.getValue() || !isa<FileEntry *>(Entry.getValue()->V))
continue;
FileEntryRef FE(Entry);
// Add this file if it's the first one with the UID, or if its name is