[PATCH] D151480: [NFC][CLANG] Fix nullptr dereference issue in CodeGenModule::​GetConstantArrayFromStr ingLiteral()

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 27 07:20:21 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGf59795b2b703: [NFC][CLANG] Fix nullptr dereference issue in CodeGenModule… (authored by Manna).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151480

Files:
  clang/lib/CodeGen/CodeGenModule.cpp


Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -5888,6 +5888,7 @@
 
     // Resize the string to the right size, which is indicated by its type.
     const ConstantArrayType *CAT = Context.getAsConstantArrayType(E->getType());
+    assert(CAT && "String literal not of constant array type!");
     Str.resize(CAT->getSize().getZExtValue());
     return llvm::ConstantDataArray::getString(VMContext, Str, false);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151480.526265.patch
Type: text/x-patch
Size: 564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230527/19667e75/attachment-0001.bin>


More information about the cfe-commits mailing list