Skip to content

Commit f13d3f7

Browse files
[Tooling] Simplify code with StringMap::operator[] (NFC) (#113071)
1 parent 2ce10f0 commit f13d3f7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clang/lib/Tooling/Inclusions/HeaderIncludes.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,9 @@ HeaderIncludes::HeaderIncludes(StringRef FileName, StringRef Code,
335335
// \p Offset: the start of the line following this include directive.
336336
void HeaderIncludes::addExistingInclude(Include IncludeToAdd,
337337
unsigned NextLineOffset) {
338-
auto Iter =
339-
ExistingIncludes.try_emplace(trimInclude(IncludeToAdd.Name)).first;
340-
Iter->second.push_back(std::move(IncludeToAdd));
341-
auto &CurInclude = Iter->second.back();
338+
auto &Incs = ExistingIncludes[trimInclude(IncludeToAdd.Name)];
339+
Incs.push_back(std::move(IncludeToAdd));
340+
auto &CurInclude = Incs.back();
342341
// The header name with quotes or angle brackets.
343342
// Only record the offset of current #include if we can insert after it.
344343
if (CurInclude.R.getOffset() <= MaxInsertOffset) {

0 commit comments

Comments
 (0)