[PATCH] D43558: TableGen: Add strict assertions to sanity check earlier type checking

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 07:29:29 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL325800: TableGen: Add strict assertions to sanity check earlier type checking (authored by nha, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D43558

Files:
  llvm/trunk/include/llvm/TableGen/Record.h
  llvm/trunk/lib/TableGen/Record.cpp


Index: llvm/trunk/include/llvm/TableGen/Record.h
===================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h
+++ llvm/trunk/include/llvm/TableGen/Record.h
@@ -1241,6 +1241,8 @@
   bool setValue(Init *V) {
     if (V) {
       Value = V->convertInitializerTo(getType());
+      assert(!Value || !isa<TypedInit>(Value) ||
+             cast<TypedInit>(Value)->getType()->typeIsConvertibleTo(getType()));
       return Value == nullptr;
     }
     Value = nullptr;
Index: llvm/trunk/lib/TableGen/Record.cpp
===================================================================
--- llvm/trunk/lib/TableGen/Record.cpp
+++ llvm/trunk/lib/TableGen/Record.cpp
@@ -478,6 +478,9 @@
   if (ListInit *I = ThePool.FindNodeOrInsertPos(ID, IP))
     return I;
 
+  assert(Range.empty() || !isa<TypedInit>(Range[0]) ||
+         cast<TypedInit>(Range[0])->getType()->typeIsConvertibleTo(EltTy));
+
   void *Mem = Allocator.Allocate(totalSizeToAlloc<Init *>(Range.size()),
                                  alignof(ListInit));
   ListInit *I = new(Mem) ListInit(Range.size(), EltTy);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43558.135424.patch
Type: text/x-patch
Size: 1120 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180222/abea4eda/attachment.bin>


More information about the llvm-commits mailing list