Skip to content

Commit a013387

Browse files
[DebugInfo] Use heterogenous lookups with std::map (NFC) (#132354)
Heterogenous lookups allow us to call find with StringRef, avoiding a temporary heap allocation of std::string.
1 parent a2661a9 commit a013387

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

llvm/include/llvm/DebugInfo/DWARF/DWARFVerifier.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct AggregationData {
3737

3838
class OutputCategoryAggregator {
3939
private:
40-
std::map<std::string, AggregationData> Aggregation;
40+
std::map<std::string, AggregationData, std::less<>> Aggregation;
4141
bool IncludeDetail;
4242

4343
public:

llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2194,7 +2194,7 @@ void OutputCategoryAggregator::EnumerateResults(
21942194
}
21952195
void OutputCategoryAggregator::EnumerateDetailedResultsFor(
21962196
StringRef category, std::function<void(StringRef, unsigned)> handleCounts) {
2197-
const auto Agg = Aggregation.find(std::string(category));
2197+
const auto Agg = Aggregation.find(category);
21982198
if (Agg != Aggregation.end()) {
21992199
for (const auto &[name, aggData] : Agg->second.DetailedCounts) {
22002200
handleCounts(name, aggData);

0 commit comments

Comments
 (0)