[clang-tools-extra] [clang-change-namespace] Avoid repeated hash lookups (NFC) (PR #111784)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 9 20:11:21 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/111784
None
>From faf633c5d8a3f255aca95d80bbc4e4e2eede84e3 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 9 Oct 2024 06:51:41 -0700
Subject: [PATCH] [clang-change-namespace] Avoid repeated hash lookups (NFC)
---
clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp b/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp
index 879c0d26d472a8..850df7daf5c038 100644
--- a/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp
+++ b/clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp
@@ -606,9 +606,8 @@ void ChangeNamespaceTool::run(
Result.Nodes.getNodeAs<DeclRefExpr>("func_ref")) {
// If this reference has been processed as a function call, we do not
// process it again.
- if (ProcessedFuncRefs.count(FuncRef))
+ if (!ProcessedFuncRefs.insert(FuncRef).second)
return;
- ProcessedFuncRefs.insert(FuncRef);
const auto *Func = Result.Nodes.getNodeAs<FunctionDecl>("func_decl");
assert(Func);
const auto *Context = Result.Nodes.getNodeAs<Decl>("dc");
More information about the cfe-commits
mailing list