[clang-tools-extra] d2a96d1 - [clang-change-namespace] Avoid repeated hash lookups (NFC) (#111784)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 08:16:55 PDT 2024


Author: Kazu Hirata
Date: 2024-10-10T08:16:51-07:00
New Revision: d2a96d170a4faa0a6c42fe5f23c073891d6118b8

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

LOG: [clang-change-namespace] Avoid repeated hash lookups (NFC) (#111784)

Added: 
    

Modified: 
    clang-tools-extra/clang-change-namespace/ChangeNamespace.cpp

Removed: 
    


################################################################################
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