Skip to content

Commit 04cebd9

Browse files
author
Paul C. Anagnostopoulos
committed
Change name of Record::TheInit to CorrespondingDefInit to make code clearer.
Differential Revision: https://reviews.llvm.org/D87919
1 parent e22a4fd commit 04cebd9

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

llvm/include/llvm/TableGen/Record.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,8 @@ class Record {
14471447
// Tracks Record instances. Not owned by Record.
14481448
RecordKeeper &TrackedRecords;
14491449

1450-
DefInit *TheInit = nullptr;
1450+
// The DefInit corresponding to this record.
1451+
DefInit *CorrespondingDefInit = nullptr;
14511452

14521453
// Unique record ID.
14531454
unsigned ID;
@@ -1471,8 +1472,8 @@ class Record {
14711472
: Record(StringInit::get(N), locs, records, false, Class) {}
14721473

14731474
// When copy-constructing a Record, we must still guarantee a globally unique
1474-
// ID number. Don't copy TheInit either since it's owned by the original
1475-
// record. All other fields can be copied normally.
1475+
// ID number. Don't copy CorrespondingDefInit either, since it's owned by the
1476+
// original record. All other fields can be copied normally.
14761477
Record(const Record &O)
14771478
: Name(O.Name), Locs(O.Locs), TemplateArgs(O.TemplateArgs),
14781479
Values(O.Values), SuperClasses(O.SuperClasses),
@@ -1586,7 +1587,8 @@ class Record {
15861587
}
15871588

15881589
void addSuperClass(Record *R, SMRange Range) {
1589-
assert(!TheInit && "changing type of record after it has been referenced");
1590+
assert(!CorrespondingDefInit &&
1591+
"changing type of record after it has been referenced");
15901592
assert(!isSubClassOf(R) && "Already subclassing record!");
15911593
SuperClasses.push_back(std::make_pair(R, Range));
15921594
}

llvm/lib/TableGen/Record.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2089,9 +2089,9 @@ RecordRecTy *Record::getType() {
20892089
}
20902090

20912091
DefInit *Record::getDefInit() {
2092-
if (!TheInit)
2093-
TheInit = new(Allocator) DefInit(this);
2094-
return TheInit;
2092+
if (!CorrespondingDefInit)
2093+
CorrespondingDefInit = new (Allocator) DefInit(this);
2094+
return CorrespondingDefInit;
20952095
}
20962096

20972097
void Record::setName(Init *NewName) {

0 commit comments

Comments
 (0)