[clang] [TableGen] Migrate away from PointerUnion::dyn_cast (NFC) (PR #125158)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 30 20:14:35 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
Note that PointerUnion::dyn_cast 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>
Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
because we expect DiagsInPedantic and GroupsInPedantic to be nonnull.
---
Full diff: https://github.com/llvm/llvm-project/pull/125158.diff
1 Files Affected:
- (modified) clang/utils/TableGen/ClangDiagnosticsEmitter.cpp (+2-2)
``````````diff
diff --git a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
index 50dbe4d5a8cab77..8f846a4744bbf03 100644
--- a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
+++ b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
@@ -359,7 +359,7 @@ void InferPedantic::compute(VecOrSet DiagsInPedantic,
// The diagnostic is not included in a group that is (transitively) in
// -Wpedantic. Include it in -Wpedantic directly.
- if (auto *V = DiagsInPedantic.dyn_cast<RecordVec *>())
+ if (auto *V = dyn_cast<RecordVec *>(DiagsInPedantic))
V->push_back(R);
else
cast<RecordSet *>(DiagsInPedantic)->insert(R);
@@ -386,7 +386,7 @@ void InferPedantic::compute(VecOrSet DiagsInPedantic,
if (Parents.size() > 0 && AllParentsInPedantic)
continue;
- if (auto *V = GroupsInPedantic.dyn_cast<RecordVec *>())
+ if (auto *V = dyn_cast<RecordVec *>(GroupsInPedantic))
V->push_back(Group);
else
cast<RecordSet *>(GroupsInPedantic)->insert(Group);
``````````
</details>
https://github.com/llvm/llvm-project/pull/125158
More information about the cfe-commits
mailing list