1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 10:32:48 +02:00

DetailedRecordsBackend.cpp - printSectionHeading - avoid std::string creation/copies.

Don't create std::string from constant c-strings or pass std::string by value - we can use StringRef instead.
This commit is contained in:
Simon Pilgrim 2021-06-13 16:49:40 +01:00
parent 9ec7689e46
commit 910cf30f57

View File

@ -45,7 +45,7 @@ public:
void printVariables(raw_ostream &OS); void printVariables(raw_ostream &OS);
void printClasses(raw_ostream &OS); void printClasses(raw_ostream &OS);
void printRecords(raw_ostream &OS); void printRecords(raw_ostream &OS);
void printSectionHeading(std::string Title, int Count, raw_ostream &OS); void printSectionHeading(StringRef Title, int Count, raw_ostream &OS);
void printDefms(Record *Rec, raw_ostream &OS); void printDefms(Record *Rec, raw_ostream &OS);
void printTemplateArgs(Record *Rec, raw_ostream &OS); void printTemplateArgs(Record *Rec, raw_ostream &OS);
void printSuperclasses(Record *Rec, raw_ostream &OS); void printSuperclasses(Record *Rec, raw_ostream &OS);
@ -113,7 +113,7 @@ void DetailedRecordsEmitter::printRecords(raw_ostream &OS) {
// Print a section heading with the name of the section and // Print a section heading with the name of the section and
// the item count. // the item count.
void DetailedRecordsEmitter::printSectionHeading(std::string Title, int Count, void DetailedRecordsEmitter::printSectionHeading(StringRef Title, int Count,
raw_ostream &OS) { raw_ostream &OS) {
OS << formatv("\n{0} {1} ({2}) {0}\n", "--------------------", Title, Count); OS << formatv("\n{0} {1} ({2}) {0}\n", "--------------------", Title, Count);
} }