[clang] [clang][bytecode][NFC] Remove unnecessary find() before erase() (PR #215714)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 11 21:19:03 PDT 2026
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/215714
We can just erase unconditionally.
>From 5e51e09897ac1fd9f9bfc7d9d32695fdb1811482 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Wed, 12 Aug 2026 06:15:17 +0200
Subject: [PATCH] [clang][bytecode][NFC] Remove unnecessary find() before
erase()
We can just erase unconditionally.
---
clang/lib/AST/ByteCode/Compiler.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
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);
};
}
More information about the cfe-commits
mailing list