[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
Thu May 25 11:34:16 PDT 2023
Manna created this revision.
Manna added a reviewer: erichkeane.
Herald added a project: All.
Manna requested review of this revision.
Herald added a project: clang.
This patch adds an assert.
Repository:
rG LLVM Github Monorepo
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.525716.patch
Type: text/x-patch
Size: 564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230525/7e0071b9/attachment-0001.bin>
More information about the cfe-commits
mailing list