projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0f8e0f4
)
[NFC][CLANG] Fix nullptr dereference issue in CodeGenModule::GetConstantArrayFromStri...
author
Manna, Soumi
<soumi.manna@intel.com>
Sat, 27 May 2023 14:15:24 +0000
(07:15 -0700)
committer
Manna, Soumi
<soumi.manna@intel.com>
Sat, 27 May 2023 14:16:31 +0000
(07:16 -0700)
This patch adds an assert.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D151480
clang/lib/CodeGen/CodeGenModule.cpp
patch
|
blob
|
history
diff --git
a/clang/lib/CodeGen/CodeGenModule.cpp
b/clang/lib/CodeGen/CodeGenModule.cpp
index
d2a28b6
..
49b6704
100644
(file)
--- a/
clang/lib/CodeGen/CodeGenModule.cpp
+++ b/
clang/lib/CodeGen/CodeGenModule.cpp
@@
-5888,6
+5888,7
@@
CodeGenModule::GetConstantArrayFromStringLiteral(const StringLiteral *E) {
// 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);
}