Skip to content

Commit 76b999d

Browse files
[clang-tidy] Avoid repeated map lookups (NFC) (#132656)
1 parent 432328e commit 76b999d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,10 @@ class HeaderGuardPPCallbacks : public PPCallbacks {
8888
continue;
8989

9090
// Look up Locations for this guard.
91-
SourceLocation Ifndef =
92-
Ifndefs[MacroEntry.first.getIdentifierInfo()].second;
91+
const auto &Locs = Ifndefs[MacroEntry.first.getIdentifierInfo()];
92+
SourceLocation Ifndef = Locs.second;
9393
SourceLocation Define = MacroEntry.first.getLocation();
94-
SourceLocation EndIf =
95-
EndIfs[Ifndefs[MacroEntry.first.getIdentifierInfo()].first];
94+
SourceLocation EndIf = EndIfs[Locs.first];
9695

9796
// If the macro Name is not equal to what we can compute, correct it in
9897
// the #ifndef and #define.

0 commit comments

Comments
 (0)