diff options
Diffstat (limited to 'llvm/lib/TableGen/DetailedRecordsBackend.cpp')
| -rw-r--r-- | llvm/lib/TableGen/DetailedRecordsBackend.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/TableGen/DetailedRecordsBackend.cpp b/llvm/lib/TableGen/DetailedRecordsBackend.cpp index 2c3c3358b347..e181f79b903d 100644 --- a/llvm/lib/TableGen/DetailedRecordsBackend.cpp +++ b/llvm/lib/TableGen/DetailedRecordsBackend.cpp @@ -22,10 +22,8 @@ #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" #include "llvm/TableGen/TableGenBackend.h" -#include <algorithm> -#include <set> #include <string> -#include <vector> +#include <utility> #define DEBUG_TYPE "detailed-records-backend" @@ -47,7 +45,7 @@ public: void printVariables(raw_ostream &OS); void printClasses(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 printTemplateArgs(Record *Rec, raw_ostream &OS); void printSuperclasses(Record *Rec, raw_ostream &OS); @@ -104,7 +102,8 @@ void DetailedRecordsEmitter::printRecords(raw_ostream &OS) { for (const auto &RecPair : RecordList) { auto *const Rec = RecPair.second.get(); - OS << formatv("\n{0} |{1}|\n", Rec->getNameInitAsString(), + std::string Name = Rec->getNameInitAsString(); + OS << formatv("\n{0} |{1}|\n", Name.empty() ? "\"\"" : Name, SrcMgr.getFormattedLocationNoOffset(Rec->getLoc().front())); printDefms(Rec, OS); printSuperclasses(Rec, OS); @@ -114,7 +113,7 @@ void DetailedRecordsEmitter::printRecords(raw_ostream &OS) { // Print a section heading with the name of the section and // the item count. -void DetailedRecordsEmitter::printSectionHeading(std::string Title, int Count, +void DetailedRecordsEmitter::printSectionHeading(StringRef Title, int Count, raw_ostream &OS) { OS << formatv("\n{0} {1} ({2}) {0}\n", "--------------------", Title, Count); } |
