[PATCH] D74360: [llvm][TableGen] Define FieldInit::isConcrete overload
River Riddle via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 10 18:08:42 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG52086f802e37: [llvm][TableGen] Define FieldInit::isConcrete overload (authored by rriddle).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74360/new/
https://reviews.llvm.org/D74360
Files:
llvm/include/llvm/TableGen/Record.h
llvm/lib/TableGen/Record.cpp
llvm/test/TableGen/field-access-initializers.td
Index: llvm/test/TableGen/field-access-initializers.td
===================================================================
--- /dev/null
+++ llvm/test/TableGen/field-access-initializers.td
@@ -0,0 +1,23 @@
+// RUN: llvm-tblgen %s | FileCheck %s
+// XFAIL: vg_leak
+
+// CHECK: --- Defs ---
+
+// CHECK: def A1 {
+// CHECK: string value = ?;
+// CHECK: }
+
+// CHECK: def B1 {
+// CHECK: string value = A1.value;
+// CHECK: }
+
+class A {
+ string value = ?;
+}
+
+class B<A impl> : A {
+ let value = impl.value;
+}
+
+def A1 : A;
+def B1 : B<A1>;
Index: llvm/lib/TableGen/Record.cpp
===================================================================
--- llvm/lib/TableGen/Record.cpp
+++ llvm/lib/TableGen/Record.cpp
@@ -1778,6 +1778,14 @@
return const_cast<FieldInit *>(this);
}
+bool FieldInit::isConcrete() const {
+ if (DefInit *DI = dyn_cast<DefInit>(Rec)) {
+ Init *FieldVal = DI->getDef()->getValue(FieldName)->getValue();
+ return FieldVal->isConcrete();
+ }
+ return false;
+}
+
static void ProfileCondOpInit(FoldingSetNodeID &ID,
ArrayRef<Init *> CondRange,
ArrayRef<Init *> ValRange,
Index: llvm/include/llvm/TableGen/Record.h
===================================================================
--- llvm/include/llvm/TableGen/Record.h
+++ llvm/include/llvm/TableGen/Record.h
@@ -1295,6 +1295,7 @@
Init *resolveReferences(Resolver &R) const override;
Init *Fold(Record *CurRec) const;
+ bool isConcrete() const override;
std::string getAsString() const override {
return Rec->getAsString() + "." + FieldName->getValue().str();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74360.243708.patch
Type: text/x-patch
Size: 1641 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200211/53843db3/attachment.bin>
More information about the llvm-commits
mailing list