mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[TableGen] [DetailedRecords] Print record name that is null string as ""
Differential Revision: https://reviews.llvm.org/D95312 Add a test for the backend.
This commit is contained in:
parent
b96bc31852
commit
8871b402ec
@ -104,7 +104,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);
|
||||
|
36
test/TableGen/detailed-records.td
Normal file
36
test/TableGen/detailed-records.td
Normal file
@ -0,0 +1,36 @@
|
||||
// RUN: llvm-tblgen -print-detailed-records %s | FileCheck %s
|
||||
|
||||
// This test file ensures that the DetailedRecords backend prints all
|
||||
// the global variables, classes, and records.
|
||||
|
||||
// CHECK: ----- Global Variables
|
||||
// CHECK: Answer
|
||||
// CHECK: Greeting
|
||||
|
||||
// CHECK: ----- Classes
|
||||
// CHECK: Class1
|
||||
// CHECK: Class2
|
||||
|
||||
// CHECK: ----- Records
|
||||
// CHECK: ""
|
||||
// CHECK: Info
|
||||
// CHECK: Rec1
|
||||
// CHECK: anonymous_0
|
||||
|
||||
defvar Greeting = "Hello there.";
|
||||
defvar Answer = 42;
|
||||
|
||||
class Class1 {
|
||||
}
|
||||
|
||||
class Class2 {
|
||||
}
|
||||
|
||||
def : Class1;
|
||||
|
||||
def "" : Class2;
|
||||
|
||||
def Rec1;
|
||||
|
||||
def Info : Class1;
|
||||
|
Loading…
Reference in New Issue
Block a user