[clang] [clang][bytecode] Fix contains check using llvm::find (PR #149050)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 16 03:13:22 PDT 2025


================
@@ -575,7 +575,8 @@ bool CheckConst(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
 
   // The This pointer is writable in constructors and destructors,
   // even if isConst() returns true.
-  if (llvm::find(S.InitializingBlocks, Ptr.block()))
+  if (llvm::find(S.InitializingBlocks, Ptr.block()) !=
+      S.InitializingBlocks.end())
----------------
zwuis wrote:

Can we use `llvm::is_contained`?

https://github.com/llvm/llvm-project/pull/149050


More information about the cfe-commits mailing list