Skip to content

Commit acdcdbc

Browse files
[Sema] Migrate away from PointerUnion::dyn_cast (NFC) (#123014)
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 EnumUnderlying to be nonnull.
1 parent 3a3a1e4 commit acdcdbc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17310,7 +17310,7 @@ Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
1731017310
return nullptr;
1731117311
if (EnumUnderlying) {
1731217312
EnumDecl *ED = cast<EnumDecl>(New);
17313-
if (TypeSourceInfo *TI = EnumUnderlying.dyn_cast<TypeSourceInfo *>())
17313+
if (TypeSourceInfo *TI = dyn_cast<TypeSourceInfo *>(EnumUnderlying))
1731417314
ED->setIntegerTypeSourceInfo(TI);
1731517315
else
1731617316
ED->setIntegerType(QualType(cast<const Type *>(EnumUnderlying), 0));
@@ -17943,7 +17943,7 @@ Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
1794317943

1794417944
if (EnumUnderlying) {
1794517945
EnumDecl *ED = cast<EnumDecl>(New);
17946-
if (TypeSourceInfo *TI = EnumUnderlying.dyn_cast<TypeSourceInfo*>())
17946+
if (TypeSourceInfo *TI = dyn_cast<TypeSourceInfo *>(EnumUnderlying))
1794717947
ED->setIntegerTypeSourceInfo(TI);
1794817948
else
1794917949
ED->setIntegerType(QualType(cast<const Type *>(EnumUnderlying), 0));

0 commit comments

Comments
 (0)