[clang-tidy] Avoid repeated hash lookups (NFC) (#127444)

This commit is contained in:
Kazu Hirata
2025-02-17 01:31:52 -08:00
committed by GitHub
parent b9c6d3ed26
commit ff4e21fccc

View File

@@ -199,10 +199,10 @@ void IncludeModernizePPCallbacks::InclusionDirective(
// 2. Insert `using namespace std;` to the beginning of TU.
// 3. Do nothing and let the user deal with the migration himself.
SourceLocation DiagLoc = FilenameRange.getBegin();
if (CStyledHeaderToCxx.count(FileName) != 0) {
IncludesToBeProcessed.emplace_back(
IncludeMarker{CStyledHeaderToCxx[FileName], FileName,
FilenameRange.getAsRange(), DiagLoc});
if (auto It = CStyledHeaderToCxx.find(FileName);
It != CStyledHeaderToCxx.end()) {
IncludesToBeProcessed.emplace_back(IncludeMarker{
It->second, FileName, FilenameRange.getAsRange(), DiagLoc});
} else if (DeleteHeaders.count(FileName) != 0) {
IncludesToBeProcessed.emplace_back(
// NOLINTNEXTLINE(modernize-use-emplace) - false-positive