[TableGen] Migrate away from PointerUnion::dyn_cast (NFC) (#125158)
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.
diff --git a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
index 50dbe4d..8f846a4 100644
--- a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
+++ b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp
@@ -359,7 +359,7 @@
// 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 @@
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);