aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/SampleProf.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2021-01-18 10:16:33 -0800
committerKazu Hirata <kazu@google.com>2021-01-18 10:16:33 -0800
commit28ea50f524b56e11b608ca1f768d2981579ebe75 (patch)
treeab0ca2b5f57bcba9dee958bda5f0de732abf5675 /llvm/lib/ProfileData/SampleProf.cpp
parenta58aceffad61ebffb1a860763299b3307041efa6 (diff)
downloadllvm-28ea50f524b56e11b608ca1f768d2981579ebe75.zip
llvm-28ea50f524b56e11b608ca1f768d2981579ebe75.tar.gz
llvm-28ea50f524b56e11b608ca1f768d2981579ebe75.tar.bz2
[llvm] Populate std::vector at construction time (NFC)
Diffstat (limited to 'llvm/lib/ProfileData/SampleProf.cpp')
-rw-r--r--llvm/lib/ProfileData/SampleProf.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/ProfileData/SampleProf.cpp b/llvm/lib/ProfileData/SampleProf.cpp
index 809576c..d6acc00 100644
--- a/llvm/lib/ProfileData/SampleProf.cpp
+++ b/llvm/lib/ProfileData/SampleProf.cpp
@@ -287,8 +287,7 @@ std::error_code ProfileSymbolList::read(const uint8_t *Data,
std::error_code ProfileSymbolList::write(raw_ostream &OS) {
// Sort the symbols before output. If doing compression.
// It will make the compression much more effective.
- std::vector<StringRef> SortedList;
- SortedList.insert(SortedList.begin(), Syms.begin(), Syms.end());
+ std::vector<StringRef> SortedList(Syms.begin(), Syms.end());
llvm::sort(SortedList);
std::string OutputString;
@@ -303,8 +302,7 @@ std::error_code ProfileSymbolList::write(raw_ostream &OS) {
void ProfileSymbolList::dump(raw_ostream &OS) const {
OS << "======== Dump profile symbol list ========\n";
- std::vector<StringRef> SortedList;
- SortedList.insert(SortedList.begin(), Syms.begin(), Syms.end());
+ std::vector<StringRef> SortedList(Syms.begin(), Syms.end());
llvm::sort(SortedList);
for (auto &Sym : SortedList)