Skip to content

Commit 990dbf2

Browse files
committed
[clang][Interp] OpaqueValueExprs can have null subexprs
1 parent e81ef46 commit 990dbf2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,14 +1220,18 @@ bool ByteCodeExprGen<Emitter>::VisitArrayInitLoopExpr(
12201220

12211221
template <class Emitter>
12221222
bool ByteCodeExprGen<Emitter>::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
1223+
const Expr *SourceExpr = E->getSourceExpr();
1224+
if (!SourceExpr)
1225+
return false;
1226+
12231227
if (Initializing)
1224-
return this->visitInitializer(E->getSourceExpr());
1228+
return this->visitInitializer(SourceExpr);
12251229

1226-
PrimType SubExprT = classify(E->getSourceExpr()).value_or(PT_Ptr);
1230+
PrimType SubExprT = classify(SourceExpr).value_or(PT_Ptr);
12271231
if (auto It = OpaqueExprs.find(E); It != OpaqueExprs.end())
12281232
return this->emitGetLocal(SubExprT, It->second, E);
12291233

1230-
if (!this->visit(E->getSourceExpr()))
1234+
if (!this->visit(SourceExpr))
12311235
return false;
12321236

12331237
// At this point we either have the evaluated source expression or a pointer

0 commit comments

Comments
 (0)