Skip to content

Commit 3f156ef

Browse files
[clangd] Simplify code with *Map::operator[] (NFC) (#111939)
1 parent 0f47627 commit 3f156ef

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

clang-tools-extra/clangd/Headers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ class IncludeStructure::RecordHeaders : public PPCallbacks {
7575
IDs.push_back(HID);
7676
}
7777
}
78-
Out->MainFileIncludesBySpelling.try_emplace(Inc.Written)
79-
.first->second.push_back(Out->MainFileIncludes.size() - 1);
78+
Out->MainFileIncludesBySpelling[Inc.Written].push_back(
79+
Out->MainFileIncludes.size() - 1);
8080
}
8181

8282
// Record include graph (not just for main-file includes)

clang-tools-extra/clangd/XRefs.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2282,8 +2282,7 @@ incomingCalls(const CallHierarchyItem &Item, const SymbolIndex *Index) {
22822282
elog("incomingCalls failed to convert location: {0}", Loc.takeError());
22832283
return;
22842284
}
2285-
auto It = CallsIn.try_emplace(R.Container, std::vector<Range>{}).first;
2286-
It->second.push_back(Loc->range);
2285+
CallsIn[R.Container].push_back(Loc->range);
22872286

22882287
ContainerLookup.IDs.insert(R.Container);
22892288
});

0 commit comments

Comments
 (0)