[PATCH] D157554: [NFC][Clang] Fix static analyzer concern about null pointer dereference

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


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc4ada13e4b3e: [NFC][Clang] Fix static analyzer concern about null value dereference (authored by eandrews).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157554/new/

https://reviews.llvm.org/D157554

Files:
  clang/lib/Sema/SemaExprCXX.cpp


Index: clang/lib/Sema/SemaExprCXX.cpp
===================================================================
--- clang/lib/Sema/SemaExprCXX.cpp
+++ clang/lib/Sema/SemaExprCXX.cpp
@@ -9072,8 +9072,10 @@
     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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157554.550052.patch
Type: text/x-patch
Size: 842 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230814/edb19a91/attachment-0001.bin>


More information about the cfe-commits mailing list