[clang-tools-extra] 76b999d - [clang-tidy] Avoid repeated map lookups (NFC) (#132656)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 24 00:13:25 PDT 2025
Author: Kazu Hirata
Date: 2025-03-24T00:13:21-07:00
New Revision: 76b999d70f71dd4339de60f1616c02051f51e001
URL: https://github.com/llvm/llvm-project/commit/76b999d70f71dd4339de60f1616c02051f51e001
DIFF: https://github.com/llvm/llvm-project/commit/76b999d70f71dd4339de60f1616c02051f51e001.diff
LOG: [clang-tidy] Avoid repeated map lookups (NFC) (#132656)
Added:
Modified:
clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp b/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
index afe70dc8e6d5b..f574c94e6f144 100644
--- a/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
+++ b/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
@@ -88,11 +88,10 @@ class HeaderGuardPPCallbacks : public PPCallbacks {
continue;
// Look up Locations for this guard.
- SourceLocation Ifndef =
- Ifndefs[MacroEntry.first.getIdentifierInfo()].second;
+ const auto &Locs = Ifndefs[MacroEntry.first.getIdentifierInfo()];
+ SourceLocation Ifndef = Locs.second;
SourceLocation Define = MacroEntry.first.getLocation();
- SourceLocation EndIf =
- EndIfs[Ifndefs[MacroEntry.first.getIdentifierInfo()].first];
+ SourceLocation EndIf = EndIfs[Locs.first];
// If the macro Name is not equal to what we can compute, correct it in
// the #ifndef and #define.
More information about the cfe-commits
mailing list