https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/204064

This is part of https://github.com/llvm/llvm-project/pull/186045, but makes 
sense independently.

>From 8eb2732344ca3898b078c1d9ac5fd6add3aea727 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]>
Date: Tue, 16 Jun 2026 08:28:50 +0200
Subject: [PATCH] [clang][bytecode] Rename checkReturnValue to
 checkDynamicAllocations

This is part of https://github.com/llvm/llvm-project/pull/186045,
but makes sense independently.
---
 clang/lib/AST/ByteCode/EvalEmitter.cpp      | 4 ++--
 clang/lib/AST/ByteCode/EvaluationResult.cpp | 7 ++++---
 clang/lib/AST/ByteCode/EvaluationResult.h   | 4 ++--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/clang/lib/AST/ByteCode/EvalEmitter.cpp 
b/clang/lib/AST/ByteCode/EvalEmitter.cpp
index 6e986f4bcbda5..7aeac16b9639e 100644
--- a/clang/lib/AST/ByteCode/EvalEmitter.cpp
+++ b/clang/lib/AST/ByteCode/EvalEmitter.cpp
@@ -232,7 +232,7 @@ template <> bool EvalEmitter::emitRet<PT_Ptr>(SourceInfo 
Info) {
   if (this->PtrCB)
     return (*this->PtrCB)(Ptr);
 
-  if (!EvalResult.checkReturnValue(S, Ctx, Ptr, Info))
+  if (!EvalResult.checkDynamicAllocations(S, Ctx, Ptr, Info))
     return false;
   if (CheckFullyInitialized && !EvalResult.checkFullyInitialized(S, Ptr))
     return false;
@@ -292,7 +292,7 @@ bool EvalEmitter::emitRetVoid(SourceInfo Info) {
 bool EvalEmitter::emitRetValue(SourceInfo Info) {
   const auto &Ptr = S.Stk.pop<Pointer>();
 
-  if (!EvalResult.checkReturnValue(S, Ctx, Ptr, Info))
+  if (!EvalResult.checkDynamicAllocations(S, Ctx, Ptr, Info))
     return false;
   if (CheckFullyInitialized && !EvalResult.checkFullyInitialized(S, Ptr))
     return false;
diff --git a/clang/lib/AST/ByteCode/EvaluationResult.cpp 
b/clang/lib/AST/ByteCode/EvaluationResult.cpp
index 24f242758324e..4ec49af9787ca 100644
--- a/clang/lib/AST/ByteCode/EvaluationResult.cpp
+++ b/clang/lib/AST/ByteCode/EvaluationResult.cpp
@@ -198,9 +198,10 @@ static void collectBlocks(PtrView Ptr, 
llvm::SetVector<const Block *> &Blocks) {
   }
 }
 
-bool EvaluationResult::checkReturnValue(InterpState &S, const Context &Ctx,
-                                        const Pointer &Ptr,
-                                        const SourceInfo &Info) {
+bool EvaluationResult::checkDynamicAllocations(InterpState &S,
+                                               const Context &Ctx,
+                                               const Pointer &Ptr,
+                                               SourceInfo Info) {
   if (!Ptr.isBlockPointer())
     return true;
   // Collect all blocks that this pointer (transitively) points to and
diff --git a/clang/lib/AST/ByteCode/EvaluationResult.h 
b/clang/lib/AST/ByteCode/EvaluationResult.h
index c296cc98ca375..bd08ac1466691 100644
--- a/clang/lib/AST/ByteCode/EvaluationResult.h
+++ b/clang/lib/AST/ByteCode/EvaluationResult.h
@@ -85,8 +85,8 @@ class EvaluationResult final {
   bool checkFullyInitialized(InterpState &S, const Pointer &Ptr) const;
   /// Check that none of the blocks the given pointer (transitively) points
   /// to are dynamically allocated.
-  bool checkReturnValue(InterpState &S, const Context &Ctx, const Pointer &Ptr,
-                        const SourceInfo &Info);
+  bool checkDynamicAllocations(InterpState &S, const Context &Ctx,
+                               const Pointer &Ptr, SourceInfo Info);
 
   QualType getSourceType() const {
     if (const auto *D =

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

Reply via email to