Skip to content

Commit 02a56c4

Browse files
[AST] Migrate away from PointerUnion::dyn_cast (NFC) (#123444)
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 ValueOrInherited to be nonnull. Note that isSet checks to see if ValueOrInherited is nonnull.
1 parent 0a33532 commit 02a56c4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clang/include/clang/AST/DeclTemplate.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,11 @@ class DefaultArgStorage {
367367
if (!isSet())
368368
ValueOrInherited = InheritedFrom;
369369
else if ([[maybe_unused]] auto *D =
370-
ValueOrInherited.template dyn_cast<ParmDecl *>()) {
370+
dyn_cast<ParmDecl *>(ValueOrInherited)) {
371371
assert(C.isSameDefaultTemplateArgument(D, InheritedFrom));
372372
ValueOrInherited =
373373
new (allocateDefaultArgStorageChain(C)) Chain{InheritedFrom, get()};
374-
} else if (auto *Inherited =
375-
ValueOrInherited.template dyn_cast<Chain *>()) {
374+
} else if (auto *Inherited = dyn_cast<Chain *>(ValueOrInherited)) {
376375
assert(C.isSameDefaultTemplateArgument(Inherited->PrevDeclWithDefaultArg,
377376
InheritedFrom));
378377
Inherited->PrevDeclWithDefaultArg = InheritedFrom;

0 commit comments

Comments
 (0)