From 6fae83ec21ca715ec9163047bdda002e3a901270 Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Tue, 6 Aug 2019 17:03:50 +0000 Subject: [PATCH] [TableGen] FieldInit: improve assertion message Summary: When fiddling with sched profiles, especially creating new ones, it's amazingly easy to end up with malformed .td that crashes tablegen, without explanation of the bug. This changes the most common assertion i have encountered to dump enough information to be able to fix the .td Split of from D63628 Reviewers: RKSimon, craig.topper, nhaehnle Reviewed By: craig.topper Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65790 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368060 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/TableGen/Record.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/llvm/TableGen/Record.h b/include/llvm/TableGen/Record.h index bf7f02208c2..6a3e2a9169e 100644 --- a/include/llvm/TableGen/Record.h +++ b/include/llvm/TableGen/Record.h @@ -1263,7 +1263,14 @@ class FieldInit : public TypedInit { FieldInit(Init *R, StringInit *FN) : TypedInit(IK_FieldInit, R->getFieldType(FN)), Rec(R), FieldName(FN) { - assert(getType() && "FieldInit with non-record type!"); +#ifndef NDEBUG + if (!getType()) { + llvm::errs() << "In Record = " << Rec->getAsString() + << ", got FieldName = " << *FieldName + << " with non-record type!\n"; + llvm_unreachable("FieldInit with non-record type!"); + } +#endif } public: -- 2.40.0