Skip to content

Commit 844c5a6

Browse files
committed
Prefer insert functions over raw loops
1 parent f774e44 commit 844c5a6

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,19 @@ IncludeModernizePPCallbacks::IncludeModernizePPCallbacks(
147147
{"string.h", "cstring"}, {"time.h", "ctime"},
148148
{"wchar.h", "cwchar"}, {"wctype.h", "cwctype"},
149149
};
150-
for (const auto &KeyValue : CXX98Headers)
151-
CStyledHeaderToCxx.insert(KeyValue);
150+
CStyledHeaderToCxx.insert(std::begin(CXX98Headers), std::end(CXX98Headers));
152151

153152
static constexpr std::pair<StringRef, StringRef> CXX11Headers[] = {
154153
{"fenv.h", "cfenv"}, {"stdint.h", "cstdint"},
155154
{"inttypes.h", "cinttypes"}, {"tgmath.h", "ctgmath"},
156155
{"uchar.h", "cuchar"},
157156
};
158157
if (LangOpts.CPlusPlus11)
159-
for (const auto &KeyValue : CXX11Headers)
160-
CStyledHeaderToCxx.insert(KeyValue);
158+
CStyledHeaderToCxx.insert(std::begin(CXX11Headers), std::end(CXX11Headers));
161159

162160
static constexpr StringRef HeadersToDelete[] = {"stdalign.h", "stdbool.h",
163161
"iso646.h"};
164-
for (const auto &Key : HeadersToDelete)
165-
DeleteHeaders.insert(Key);
162+
DeleteHeaders.insert_range(HeadersToDelete);
166163
}
167164

168165
void IncludeModernizePPCallbacks::InclusionDirective(

0 commit comments

Comments
 (0)