[clang] 990dbf2 - [clang][Interp] OpaqueValueExprs can have null subexprs
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 1 01:13:01 PST 2024
Author: Timm Bäder
Date: 2024-03-01T10:12:50+01:00
New Revision: 990dbf2b7ebb1ddf1a53eb0b25061a0ea42f4ae1
URL: https://github.com/llvm/llvm-project/commit/990dbf2b7ebb1ddf1a53eb0b25061a0ea42f4ae1
DIFF: https://github.com/llvm/llvm-project/commit/990dbf2b7ebb1ddf1a53eb0b25061a0ea42f4ae1.diff
LOG: [clang][Interp] OpaqueValueExprs can have null subexprs
Added:
Modified:
clang/lib/AST/Interp/ByteCodeExprGen.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 122b9045a75f6e..0185214fb455de 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -1220,14 +1220,18 @@ bool ByteCodeExprGen<Emitter>::VisitArrayInitLoopExpr(
template <class Emitter>
bool ByteCodeExprGen<Emitter>::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
+ const Expr *SourceExpr = E->getSourceExpr();
+ if (!SourceExpr)
+ return false;
+
if (Initializing)
- return this->visitInitializer(E->getSourceExpr());
+ return this->visitInitializer(SourceExpr);
- PrimType SubExprT = classify(E->getSourceExpr()).value_or(PT_Ptr);
+ PrimType SubExprT = classify(SourceExpr).value_or(PT_Ptr);
if (auto It = OpaqueExprs.find(E); It != OpaqueExprs.end())
return this->emitGetLocal(SubExprT, It->second, E);
- if (!this->visit(E->getSourceExpr()))
+ if (!this->visit(SourceExpr))
return false;
// At this point we either have the evaluated source expression or a pointer
More information about the cfe-commits
mailing list