[clang] e28d440 - [clang-refactor] Simplify code with std::map::operator[] (NFC) (#114933)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 09:40:00 PST 2024


Author: Kazu Hirata
Date: 2024-11-05T09:39:57-08:00
New Revision: e28d44086f9d23b2aa6e4ae563bd4932b382477b

URL: https://github.com/llvm/llvm-project/commit/e28d44086f9d23b2aa6e4ae563bd4932b382477b
DIFF: https://github.com/llvm/llvm-project/commit/e28d44086f9d23b2aa6e4ae563bd4932b382477b.diff

LOG: [clang-refactor] Simplify code with std::map::operator[] (NFC) (#114933)

Added: 
    

Modified: 
    clang/tools/clang-refactor/TestSupport.cpp

Removed: 
    


################################################################################
diff  --git a/clang/tools/clang-refactor/TestSupport.cpp b/clang/tools/clang-refactor/TestSupport.cpp
index 8b6e250b3632d0..82376fa5d247f4 100644
--- a/clang/tools/clang-refactor/TestSupport.cpp
+++ b/clang/tools/clang-refactor/TestSupport.cpp
@@ -373,10 +373,7 @@ findTestSelectionRanges(StringRef Filename) {
       EndOffset = Offset;
     }
     TestSelectionRange Range = {Offset, EndOffset};
-    auto It = GroupedRanges.insert(std::make_pair(
-        Matches[1].str(), SmallVector<TestSelectionRange, 8>{Range}));
-    if (!It.second)
-      It.first->second.push_back(Range);
+    GroupedRanges[Matches[1].str()].push_back(Range);
   }
   if (GroupedRanges.empty()) {
     llvm::errs() << "error: -selection=test:" << Filename


        


More information about the cfe-commits mailing list