[clang] [clang][bytecode][NFC] Remove unnecessary find() before erase() (PR #215714)

via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 21:19:43 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

We can just erase unconditionally.

---
Full diff: https://github.com/llvm/llvm-project/pull/215714.diff


1 Files Affected:

- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+1-3) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 316b2a4f092f9..04628cd95c2cf 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -206,9 +206,7 @@ template <class Emitter> class LocalScope : public VariableScope<Emitter> {
   void removeIfStoredOpaqueValue(const Scope::Local &Local) {
     if (const auto *OVE =
             llvm::dyn_cast_if_present<OpaqueValueExpr>(Local.Desc->asExpr())) {
-      if (auto It = this->Ctx->OpaqueExprs.find(OVE);
-          It != this->Ctx->OpaqueExprs.end())
-        this->Ctx->OpaqueExprs.erase(It);
+      this->Ctx->OpaqueExprs.erase(OVE);
     };
   }
 

``````````

</details>


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


More information about the cfe-commits mailing list