[clang] c4ada13 - [NFC][Clang] Fix static analyzer concern about null value dereference

Elizabeth Andrews via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 12:20:59 PDT 2023


Author: Elizabeth Andrews
Date: 2023-08-14T12:19:45-07:00
New Revision: c4ada13e4b3e72543e454a12a6db085812114c0c

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

LOG: [NFC][Clang] Fix static analyzer concern about null value dereference

Differential Revision: https://reviews.llvm.org/D157554

Added: 
    

Modified: 
    clang/lib/Sema/SemaExprCXX.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 82afb084efd0b1..e6eb9508f8e6ff 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -9072,8 +9072,10 @@ Sema::BuildExprRequirement(
     MultiLevelTemplateArgumentList MLTAL(Param, TAL.asArray(),
                                          /*Final=*/false);
     MLTAL.addOuterRetainedLevels(TPL->getDepth());
-    Expr *IDC = Param->getTypeConstraint()->getImmediatelyDeclaredConstraint();
-    ExprResult Constraint = SubstExpr(IDC, MLTAL);
+    const TypeConstraint *TC = Param->getTypeConstraint();
+    assert(TC && "Type Constraint cannot be null here");
+    ExprResult Constraint =
+        SubstExpr(TC->getImmediatelyDeclaredConstraint(), MLTAL);
     if (Constraint.isInvalid()) {
       Status = concepts::ExprRequirement::SS_ExprSubstitutionFailure;
     } else {


        


More information about the cfe-commits mailing list