[llvm] 04cebd9 - Change name of Record::TheInit to CorrespondingDefInit to make code clearer.

Paul C. Anagnostopoulos via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 19 06:19:39 PDT 2020


Author: Paul C. Anagnostopoulos
Date: 2020-09-19T09:18:44-04:00
New Revision: 04cebd900fde2c10d31a149895ed2495ff0994f7

URL: https://github.com/llvm/llvm-project/commit/04cebd900fde2c10d31a149895ed2495ff0994f7
DIFF: https://github.com/llvm/llvm-project/commit/04cebd900fde2c10d31a149895ed2495ff0994f7.diff

LOG: Change name of Record::TheInit to CorrespondingDefInit to make code clearer.

Differential Revision: https://reviews.llvm.org/D87919

Added: 
    

Modified: 
    llvm/include/llvm/TableGen/Record.h
    llvm/lib/TableGen/Record.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h
index 5d67ef4455cf..3724c2651c06 100644
--- a/llvm/include/llvm/TableGen/Record.h
+++ b/llvm/include/llvm/TableGen/Record.h
@@ -1447,7 +1447,8 @@ class Record {
   // Tracks Record instances. Not owned by Record.
   RecordKeeper &TrackedRecords;
 
-  DefInit *TheInit = nullptr;
+  // The DefInit corresponding to this record.
+  DefInit *CorrespondingDefInit = nullptr;
 
   // Unique record ID.
   unsigned ID;
@@ -1471,8 +1472,8 @@ class Record {
       : Record(StringInit::get(N), locs, records, false, Class) {}
 
   // When copy-constructing a Record, we must still guarantee a globally unique
-  // ID number.  Don't copy TheInit either since it's owned by the original
-  // record. All other fields can be copied normally.
+  // ID number. Don't copy CorrespondingDefInit either, since it's owned by the
+  // original record. All other fields can be copied normally.
   Record(const Record &O)
     : Name(O.Name), Locs(O.Locs), TemplateArgs(O.TemplateArgs),
       Values(O.Values), SuperClasses(O.SuperClasses),
@@ -1586,7 +1587,8 @@ class Record {
   }
 
   void addSuperClass(Record *R, SMRange Range) {
-    assert(!TheInit && "changing type of record after it has been referenced");
+    assert(!CorrespondingDefInit &&
+           "changing type of record after it has been referenced");
     assert(!isSubClassOf(R) && "Already subclassing record!");
     SuperClasses.push_back(std::make_pair(R, Range));
   }

diff  --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp
index 3c40d45c1e05..a56d50b33b21 100644
--- a/llvm/lib/TableGen/Record.cpp
+++ b/llvm/lib/TableGen/Record.cpp
@@ -2089,9 +2089,9 @@ RecordRecTy *Record::getType() {
 }
 
 DefInit *Record::getDefInit() {
-  if (!TheInit)
-    TheInit = new(Allocator) DefInit(this);
-  return TheInit;
+  if (!CorrespondingDefInit)
+    CorrespondingDefInit = new (Allocator) DefInit(this);
+  return CorrespondingDefInit;
 }
 
 void Record::setName(Init *NewName) {


        


More information about the llvm-commits mailing list