Skip to content

Commit c517edb

Browse files
[Sema] Migrate away from PointerUnion::dyn_cast (NFC) (#125811)
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 Specialized to be nonnull. Note that if Specialized were null, dereferencing Tmpl would trigger a segfault.
1 parent 08bda1c commit c517edb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/Sema/SemaTemplateInstantiate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ HandleVarTemplateSpec(const VarTemplateSpecializationDecl *VarTemplSpec,
190190
llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
191191
Specialized = VarTemplSpec->getSpecializedTemplateOrPartial();
192192
if (VarTemplatePartialSpecializationDecl *Partial =
193-
Specialized.dyn_cast<VarTemplatePartialSpecializationDecl *>()) {
193+
dyn_cast<VarTemplatePartialSpecializationDecl *>(Specialized)) {
194194
if (!SkipForSpecialization)
195195
Result.addOuterTemplateArguments(
196196
Partial, VarTemplSpec->getTemplateInstantiationArgs().asArray(),

0 commit comments

Comments
 (0)