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

Not sure why I used a SetVector here, but switch it to a SmallPtrSet (this also 
gets rid of an additional include when #186045 gets merged).

>From eefb70861fdbbc9b009a16bb6611eeedf4daf02f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]>
Date: Sun, 23 Aug 2026 06:44:53 +0200
Subject: [PATCH] [clang][bytecode] Use a SmallPtrSet in collectBlocks()

---
 clang/lib/AST/ByteCode/EvaluationResult.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/clang/lib/AST/ByteCode/EvaluationResult.cpp 
b/clang/lib/AST/ByteCode/EvaluationResult.cpp
index 6597ea062a8fb..bc939c9a5c8fc 100644
--- a/clang/lib/AST/ByteCode/EvaluationResult.cpp
+++ b/clang/lib/AST/ByteCode/EvaluationResult.cpp
@@ -11,7 +11,7 @@
 #include "Pointer.h"
 #include "Record.h"
 #include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include <iterator>
 
 namespace clang {
@@ -171,7 +171,8 @@ static bool isOrHasPtr(const Descriptor *D) {
   return false;
 }
 
-static void collectBlocks(PtrView Ptr, llvm::SetVector<const Block *> &Blocks,
+static void collectBlocks(PtrView Ptr,
+                          llvm::SmallPtrSet<const Block *, 4> &Blocks,
                           bool IsCompleteClass = true) {
   auto isUsefulPtr = [](const Pointer &P) -> bool {
     return P.isLive() && P.isBlockPointer() && !P.isZero() && !P.isDummy() &&
@@ -250,7 +251,7 @@ bool EvaluationResult::checkDynamicAllocations(InterpState 
&S,
     return true;
   // Collect all blocks that this pointer (transitively) points to and
   // return false if any of them is a dynamic block.
-  llvm::SetVector<const Block *> Blocks;
+  llvm::SmallPtrSet<const Block *, 4> Blocks;
 
   collectBlocks(Ptr.view(), Blocks);
 

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

Reply via email to