[llvm] 9144e49 - [Support] Drop unnecessary const from a return type (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 14 12:52:12 PDT 2022
Author: Kazu Hirata
Date: 2022-08-14T12:51:56-07:00
New Revision: 9144e4933463d35df259ca8a5207119e1fc0c97c
URL: https://github.com/llvm/llvm-project/commit/9144e4933463d35df259ca8a5207119e1fc0c97c
DIFF: https://github.com/llvm/llvm-project/commit/9144e4933463d35df259ca8a5207119e1fc0c97c.diff
LOG: [Support] Drop unnecessary const from a return type (NFC)
Identified with readability-const-return-type.
Added:
Modified:
llvm/include/llvm/ADT/Statistic.h
llvm/lib/Support/Statistic.cpp
llvm/unittests/ADT/StatisticTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/Statistic.h b/llvm/include/llvm/ADT/Statistic.h
index 6c195cc44990b..9475b6697031a 100644
--- a/llvm/include/llvm/ADT/Statistic.h
+++ b/llvm/include/llvm/ADT/Statistic.h
@@ -200,7 +200,7 @@ void PrintStatisticsJSON(raw_ostream &OS);
/// during it's execution. It will return the value at the point that it is
/// read. However, it will prevent new statistics from registering until it
/// completes.
-const std::vector<std::pair<StringRef, uint64_t>> GetStatistics();
+std::vector<std::pair<StringRef, uint64_t>> GetStatistics();
/// Reset the statistics. This can be used to zero and de-register the
/// statistics in order to measure a compilation.
diff --git a/llvm/lib/Support/Statistic.cpp b/llvm/lib/Support/Statistic.cpp
index ec12118650c1b..df9f7c5e0be39 100644
--- a/llvm/lib/Support/Statistic.cpp
+++ b/llvm/lib/Support/Statistic.cpp
@@ -253,7 +253,7 @@ void llvm::PrintStatistics() {
#endif
}
-const std::vector<std::pair<StringRef, uint64_t>> llvm::GetStatistics() {
+std::vector<std::pair<StringRef, uint64_t>> llvm::GetStatistics() {
sys::SmartScopedLock<true> Reader(*StatLock);
std::vector<std::pair<StringRef, uint64_t>> ReturnStats;
diff --git a/llvm/unittests/ADT/StatisticTest.cpp b/llvm/unittests/ADT/StatisticTest.cpp
index 523f510cccdde..470d20340e664 100644
--- a/llvm/unittests/ADT/StatisticTest.cpp
+++ b/llvm/unittests/ADT/StatisticTest.cpp
@@ -128,7 +128,7 @@ TEST(StatisticTest, API) {
// It should empty the list and zero the counters.
ResetStatistics();
{
- auto &Range = GetStatistics();
+ auto Range = GetStatistics();
EXPECT_EQ(Range.begin(), Range.end());
EXPECT_EQ(Counter, 0u);
EXPECT_EQ(Counter2, 0u);
@@ -144,7 +144,7 @@ TEST(StatisticTest, API) {
Counter2++;
{
- auto &Range = GetStatistics();
+ auto Range = GetStatistics();
EXPECT_EQ(Range.begin() + 2, Range.end());
EXPECT_EQ(Counter, 1u);
EXPECT_EQ(Counter2, 1u);
More information about the llvm-commits
mailing list