[clang] [Serialization] Migrate away from PointerUnion::get (NFC) (PR #120844)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 21 09:06:13 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
Note that PointerUnion::get has 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.
---
Full diff: https://github.com/llvm/llvm-project/pull/120844.diff
1 Files Affected:
- (modified) clang/lib/Serialization/MultiOnDiskHashTable.h (+2-2)
``````````diff
diff --git a/clang/lib/Serialization/MultiOnDiskHashTable.h b/clang/lib/Serialization/MultiOnDiskHashTable.h
index a0d75ec3a9e76e..6464220f13aeff 100644
--- a/clang/lib/Serialization/MultiOnDiskHashTable.h
+++ b/clang/lib/Serialization/MultiOnDiskHashTable.h
@@ -93,7 +93,7 @@ template<typename Info> class MultiOnDiskHashTable {
using result_type = OnDiskTable *;
result_type operator()(void *P) const {
- return Table::getFromOpaqueValue(P).template get<OnDiskTable *>();
+ return llvm::cast<OnDiskTable *>(Table::getFromOpaqueValue(P));
}
};
@@ -130,7 +130,7 @@ template<typename Info> class MultiOnDiskHashTable {
Files.insert(PendingOverrides.begin(), PendingOverrides.end());
// Explicitly capture Files to work around an MSVC 2015 rejects-valid bug.
auto ShouldRemove = [&Files](void *T) -> bool {
- auto *ODT = Table::getFromOpaqueValue(T).template get<OnDiskTable *>();
+ auto *ODT = llvm::cast<OnDiskTable *>(Table::getFromOpaqueValue(T));
bool Remove = Files.count(ODT->File);
if (Remove)
delete ODT;
``````````
</details>
https://github.com/llvm/llvm-project/pull/120844
More information about the cfe-commits
mailing list