llvmorg-github-actions[bot] 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&lt;T&gt;, cast&lt;T&gt; and the llvm::dyn_cast&lt;T&gt;

Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast.
Note that:

    assert(ClassTemplSpec-&gt;getSpecializedTemplate() &amp;&amp; ...);

a few lines above guarantees that
ClassTemplSpec-&gt;getSpecializedTemplateOrPartial() is nonnull.

Assisted-by: Antigravity


---
Full diff: https://github.com/llvm/llvm-project/pull/228673.diff


1 Files Affected:

- (modified) clang/lib/Sema/SemaTemplateInstantiate.cpp (+2-2) 


``````````diff
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp 
b/clang/lib/Sema/SemaTemplateInstantiate.cpp
index 06ea12ca7bd73..036642f22bd8c 100644
--- a/clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -257,8 +257,8 @@ HandleClassTemplateSpec(const 
ClassTemplateSpecializationDecl *ClassTemplSpec,
     // specialization, as the ClassTemplateSpecializationDecl's
     // DeclContext/LexicalDeclContext will be for the primary template.
     if (auto *InstFromPartialTempl =
-            ClassTemplSpec->getSpecializedTemplateOrPartial()
-                .dyn_cast<ClassTemplatePartialSpecializationDecl *>())
+            dyn_cast<ClassTemplatePartialSpecializationDecl *>(
+                ClassTemplSpec->getSpecializedTemplateOrPartial()))
       return Response::ChangeDecl(
           InstFromPartialTempl->getLexicalDeclContext());
   }

``````````

</details>


https://github.com/llvm/llvm-project/pull/228673
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to