diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-07-31 15:50:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-31 15:50:02 +0200 |
commit | f4aaf6fe5c6b7911d8b5f669646372c8c7dc19f4 (patch) | |
tree | 92dbc7204b8412cf92885d810338e09139a4b8d6 /clang/lib/AST/ByteCode/Compiler.cpp | |
parent | 311b2918129192b9171793406b0c53d9bdd9240b (diff) | |
download | llvm-f4aaf6fe5c6b7911d8b5f669646372c8c7dc19f4.zip llvm-f4aaf6fe5c6b7911d8b5f669646372c8c7dc19f4.tar.gz llvm-f4aaf6fe5c6b7911d8b5f669646372c8c7dc19f4.tar.bz2 |
[clang][bytecode] Fix a crash in codegen (#151515)
getRecord() can return nullptr if any one of the fields does, in this
case because the array is too large for us to allocate.
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r-- | clang/lib/AST/ByteCode/Compiler.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index 8bde587..8b9e5e0 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -1758,6 +1758,9 @@ bool Compiler<Emitter>::visitInitList(ArrayRef<const Expr *> Inits, if (Inits.size() == 1 && E->getType() == Inits[0]->getType()) return this->delegate(Inits[0]); + if (!R) + return false; + auto initPrimitiveField = [=](const Record::Field *FieldToInit, const Expr *Init, PrimType T, bool Activate = false) -> bool { |