Author: Kazu Hirata Date: 2024-10-11T09:00:39-07:00 New Revision: 3f156ef4cc333bcf9389addd1e0054b654501d7e
URL: https://github.com/llvm/llvm-project/commit/3f156ef4cc333bcf9389addd1e0054b654501d7e DIFF: https://github.com/llvm/llvm-project/commit/3f156ef4cc333bcf9389addd1e0054b654501d7e.diff LOG: [clangd] Simplify code with *Map::operator[] (NFC) (#111939) Added: Modified: clang-tools-extra/clangd/Headers.cpp clang-tools-extra/clangd/XRefs.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/Headers.cpp b/clang-tools-extra/clangd/Headers.cpp index 75f8668e7bef06..b537417bd10568 100644 --- a/clang-tools-extra/clangd/Headers.cpp +++ b/clang-tools-extra/clangd/Headers.cpp @@ -75,8 +75,8 @@ class IncludeStructure::RecordHeaders : public PPCallbacks { IDs.push_back(HID); } } - Out->MainFileIncludesBySpelling.try_emplace(Inc.Written) - .first->second.push_back(Out->MainFileIncludes.size() - 1); + Out->MainFileIncludesBySpelling[Inc.Written].push_back( + Out->MainFileIncludes.size() - 1); } // Record include graph (not just for main-file includes) diff --git a/clang-tools-extra/clangd/XRefs.cpp b/clang-tools-extra/clangd/XRefs.cpp index f94cadeffaa298..b34aba603b5306 100644 --- a/clang-tools-extra/clangd/XRefs.cpp +++ b/clang-tools-extra/clangd/XRefs.cpp @@ -2282,8 +2282,7 @@ incomingCalls(const CallHierarchyItem &Item, const SymbolIndex *Index) { elog("incomingCalls failed to convert location: {0}", Loc.takeError()); return; } - auto It = CallsIn.try_emplace(R.Container, std::vector<Range>{}).first; - It->second.push_back(Loc->range); + CallsIn[R.Container].push_back(Loc->range); ContainerLookup.IDs.insert(R.Container); }); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits