Author: Timm Baeder
Date: 2026-03-13T16:28:58+01:00
New Revision: 3ecede5d6c4d9946d45125678aaefbdc593f6044

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

LOG: [clang][bytecode] Remove useless emitCheckAllocations calls (#186385)

The one at the top of visitExpr doesn't make sense (we *just* started
visiting the expression, how can there be leaked allocations?) and the
one at the bottom is already handled via maybeDestroyLocals.

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/Compiler.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index 27ae2eeb1b99c..13d6dcc92356d 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -5056,12 +5056,6 @@ template <class Emitter>
 bool Compiler<Emitter>::visitExpr(const Expr *E, bool DestroyToplevelScope) {
   LocalScope<Emitter> RootScope(this, ScopeKind::FullExpression);
 
-  // If we won't destroy the toplevel scope, check for memory leaks first.
-  if (!DestroyToplevelScope) {
-    if (!this->emitCheckAllocations(E))
-      return false;
-  }
-
   auto maybeDestroyLocals = [&]() -> bool {
     if (DestroyToplevelScope)
       return RootScope.destroyLocals() && this->emitCheckAllocations(E);
@@ -5102,7 +5096,7 @@ bool Compiler<Emitter>::visitExpr(const Expr *E, bool 
DestroyToplevelScope) {
     return this->emitRetValue(E) && maybeDestroyLocals();
   }
 
-  return maybeDestroyLocals() && this->emitCheckAllocations(E) && false;
+  return maybeDestroyLocals() && false;
 }
 
 template <class Emitter>


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to