[clang] 09ea986 - [clang][bytecode][NFC] Remove unnecessary find() before erase() (#215714)

via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 23:56:50 PDT 2026


Author: Timm Baeder
Date: 2026-08-12T08:56:44+02:00
New Revision: 09ea986b837f14f1914eec8c683cbd3e4eb7a481

URL: https://github.com/llvm/llvm-project/commit/09ea986b837f14f1914eec8c683cbd3e4eb7a481
DIFF: https://github.com/llvm/llvm-project/commit/09ea986b837f14f1914eec8c683cbd3e4eb7a481.diff

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

We can just erase unconditionally.

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 4d56865dcc4a9..bfb5df69b0e3a 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);
     };
   }
 


        


More information about the cfe-commits mailing list