[PATCH] D87560: Clarify two data member names
Paul C. Anagnostopoulos via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 12 09:00:49 PDT 2020
Paul-C-Anagnostopoulos created this revision.
Paul-C-Anagnostopoulos added reviewers: lattner, nhaehnle.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
Paul-C-Anagnostopoulos requested review of this revision.
I'm working on a "TableGen Backend Developer's Guide," so I'm looking deeply into TableGen. There are two class members whose names are vague.
The ListRecTy class has a member named Ty. I changed it to ElementTy.
The TypeInit class has a member named Ty. I changed it to ValueTy.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87560
Files:
llvm/include/llvm/TableGen/Record.h
llvm/lib/TableGen/Record.cpp
Index: llvm/lib/TableGen/Record.cpp
===================================================================
--- llvm/lib/TableGen/Record.cpp
+++ llvm/lib/TableGen/Record.cpp
@@ -128,12 +128,12 @@
}
std::string ListRecTy::getAsString() const {
- return "list<" + Ty->getAsString() + ">";
+ return "list<" + ElementTy->getAsString() + ">";
}
bool ListRecTy::typeIsConvertibleTo(const RecTy *RHS) const {
if (const auto *ListTy = dyn_cast<ListRecTy>(RHS))
- return Ty->typeIsConvertibleTo(ListTy->getElementType());
+ return ElementTy->typeIsConvertibleTo(ListTy->getElementType());
return false;
}
Index: llvm/include/llvm/TableGen/Record.h
===================================================================
--- llvm/include/llvm/TableGen/Record.h
+++ llvm/include/llvm/TableGen/Record.h
@@ -67,6 +67,7 @@
private:
RecTyKind Kind;
+ /// ListRecTy of the list that has elements of this type.
ListRecTy *ListTy = nullptr;
public:
@@ -190,14 +191,14 @@
bool typeIsConvertibleTo(const RecTy *RHS) const override;
};
-/// 'list<Ty>' - Represent a list of values, all of which must be of
-/// the specified type.
+/// 'list<Ty>' - Represent a list of element values, all of which must be of
+/// the specified type. The type is stored in ElementTy.
class ListRecTy : public RecTy {
friend ListRecTy *RecTy::getListTy();
- RecTy *Ty;
+ RecTy *ElementTy;
- explicit ListRecTy(RecTy *T) : RecTy(ListRecTyKind), Ty(T) {}
+ explicit ListRecTy(RecTy *T) : RecTy(ListRecTyKind), ElementTy(T) {}
public:
static bool classof(const RecTy *RT) {
@@ -205,7 +206,7 @@
}
static ListRecTy *get(RecTy *T) { return T->getListTy(); }
- RecTy *getElementType() const { return Ty; }
+ RecTy *getElementType() const { return ElementTy; }
std::string getAsString() const override;
@@ -420,14 +421,14 @@
I.print(OS); return OS;
}
-/// This is the common super-class of types that have a specific,
-/// explicit, type.
+/// This is the common superclass of types that have a specific,
+/// explicit, type, stored in ValueTy.
class TypedInit : public Init {
- RecTy *Ty;
+ RecTy *ValueTy;
protected:
explicit TypedInit(InitKind K, RecTy *T, uint8_t Opc = 0)
- : Init(K, Opc), Ty(T) {}
+ : Init(K, Opc), ValueTy(T) {}
public:
TypedInit(const TypedInit &) = delete;
@@ -438,7 +439,7 @@
I->getKind() <= IK_LastTypedInit;
}
- RecTy *getType() const { return Ty; }
+ RecTy *getType() const { return ValueTy; }
Init *getCastTo(RecTy *Ty) const override;
Init *convertInitializerTo(RecTy *Ty) const override;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87560.291397.patch
Type: text/x-patch
Size: 2599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200912/05bf879b/attachment.bin>
More information about the llvm-commits
mailing list