[clang] 5fb1807 - [clang][sema] ActOnExplicitInstantiation - remove Prev nullptr check

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 11 07:11:25 PST 2022


Author: Simon Pilgrim
Date: 2022-02-11T15:09:44Z
New Revision: 5fb180704c17dc66dfc7f052abe47524fdf8811f

URL: https://github.com/llvm/llvm-project/commit/5fb180704c17dc66dfc7f052abe47524fdf8811f
DIFF: https://github.com/llvm/llvm-project/commit/5fb180704c17dc66dfc7f052abe47524fdf8811f.diff

LOG: [clang][sema] ActOnExplicitInstantiation - remove Prev nullptr check

All paths have already dereferenced the Prev pointer

Added: 
    

Modified: 
    clang/lib/Sema/SemaTemplate.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 64a0b45feb98..acaa5b294aa2 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -10116,7 +10116,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
     }
 
     // Check the new variable specialization against the parsed input.
-    if (PrevTemplate && Prev && !Context.hasSameType(Prev->getType(), R)) {
+    if (PrevTemplate && !Context.hasSameType(Prev->getType(), R)) {
       Diag(T->getTypeLoc().getBeginLoc(),
            diag::err_invalid_var_template_spec_type)
           << 0 << PrevTemplate << R << Prev->getType();


        


More information about the cfe-commits mailing list