Author: Timm Bäder Date: 2024-02-10T19:45:10+01:00 New Revision: ba451c80ba67ab6834305f35d47e36b6b446ce83
URL: https://github.com/llvm/llvm-project/commit/ba451c80ba67ab6834305f35d47e36b6b446ce83 DIFF: https://github.com/llvm/llvm-project/commit/ba451c80ba67ab6834305f35d47e36b6b446ce83.diff LOG: [clang][Interp][NFC] Only set result invalid if empty This is currently NFC but required for later changes. A Ret op might fail and set the result to invalid, causing another setInvalid() call, which asserts that the result is still empty. Added: Modified: clang/lib/AST/Interp/EvalEmitter.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/Interp/EvalEmitter.cpp b/clang/lib/AST/Interp/EvalEmitter.cpp index a60f893de8bda7..945b78d7a609d7 100644 --- a/clang/lib/AST/Interp/EvalEmitter.cpp +++ b/clang/lib/AST/Interp/EvalEmitter.cpp @@ -36,7 +36,7 @@ EvalEmitter::~EvalEmitter() { EvaluationResult EvalEmitter::interpretExpr(const Expr *E) { EvalResult.setSource(E); - if (!this->visitExpr(E)) + if (!this->visitExpr(E) && EvalResult.empty()) EvalResult.setInvalid(); return std::move(this->EvalResult); @@ -45,7 +45,7 @@ EvaluationResult EvalEmitter::interpretExpr(const Expr *E) { EvaluationResult EvalEmitter::interpretDecl(const VarDecl *VD) { EvalResult.setSource(VD); - if (!this->visitDecl(VD)) + if (!this->visitDecl(VD) && EvalResult.empty()) EvalResult.setInvalid(); return std::move(this->EvalResult); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits