[clang] a7f3bca - [clang][Interp][NFCI] Handle DiscardResult for ExprWithCleanups

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 3 07:07:49 PST 2023


Author: Timm Bäder
Date: 2023-02-03T16:07:14+01:00
New Revision: a7f3bcaa8409f67e604bcbe22a960f54ebc657ef

URL: https://github.com/llvm/llvm-project/commit/a7f3bcaa8409f67e604bcbe22a960f54ebc657ef
DIFF: https://github.com/llvm/llvm-project/commit/a7f3bcaa8409f67e604bcbe22a960f54ebc657ef.diff

LOG: [clang][Interp][NFCI] Handle DiscardResult for ExprWithCleanups

Just pop the pointer.

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 b02e3ae02ae7..f8ee3a80326b 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -788,7 +788,12 @@ bool ByteCodeExprGen<Emitter>::VisitExprWithCleanups(
   const Expr *SubExpr = E->getSubExpr();
 
   assert(E->getNumObjects() == 0 && "TODO: Implement cleanups");
-  return this->visit(SubExpr);
+  if (!this->visit(SubExpr))
+    return false;
+
+  if (DiscardResult)
+    return this->emitPopPtr(E);
+  return true;
 }
 
 template <class Emitter>


        


More information about the cfe-commits mailing list