diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index 122b9045a75f6..0185214fb455d 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -1220,14 +1220,18 @@ bool ByteCodeExprGen::VisitArrayInitLoopExpr( template bool ByteCodeExprGen::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