[llvm] 5a2febb - [llvm][NFC] Remove unnecessary vector creation in Annotations

Nathan James via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 14 07:55:22 PST 2020


Author: Nathan James
Date: 2020-11-14T15:55:09Z
New Revision: 5a2febb31af7e3ee2f6d1a3495c6ccbc7c7031b5

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

LOG: [llvm][NFC] Remove unnecessary vector creation in Annotations

Added: 
    

Modified: 
    llvm/lib/Testing/Support/Annotations.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Testing/Support/Annotations.cpp b/llvm/lib/Testing/Support/Annotations.cpp
index 09c572011d36..24607bd4c7d8 100644
--- a/llvm/lib/Testing/Support/Annotations.cpp
+++ b/llvm/lib/Testing/Support/Annotations.cpp
@@ -72,8 +72,10 @@ size_t Annotations::point(llvm::StringRef Name) const {
 }
 
 std::vector<size_t> Annotations::points(llvm::StringRef Name) const {
-  auto P = Points.lookup(Name);
-  return {P.begin(), P.end()};
+  auto I = Points.find(Name);
+  if (I == Points.end())
+    return {};
+  return {I->getValue().begin(), I->getValue().end()};
 }
 
 Annotations::Range Annotations::range(llvm::StringRef Name) const {
@@ -85,8 +87,10 @@ Annotations::Range Annotations::range(llvm::StringRef Name) const {
 
 std::vector<Annotations::Range>
 Annotations::ranges(llvm::StringRef Name) const {
-  auto R = Ranges.lookup(Name);
-  return {R.begin(), R.end()};
+  auto I = Ranges.find(Name);
+  if (I == Ranges.end())
+    return {};
+  return {I->getValue().begin(), I->getValue().end()};
 }
 
 llvm::raw_ostream &llvm::operator<<(llvm::raw_ostream &O,


        


More information about the llvm-commits mailing list