From dd2a26fccb3c8c66c6aa10a03f64256101b1c773 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 1 Jun 2015 06:44:18 +0000 Subject: [PATCH] [TableGen] Move a couple virtual methods out of line so vtable anchors can be removed. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238727 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/TableGen/Record.h | 6 ++---- lib/TableGen/Record.cpp | 10 +++++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/llvm/TableGen/Record.h b/include/llvm/TableGen/Record.h index 16932a23a03..eada90d1573 100644 --- a/include/llvm/TableGen/Record.h +++ b/include/llvm/TableGen/Record.h @@ -139,7 +139,6 @@ class StringRecTy : public RecTy { static StringRecTy Shared; StringRecTy() : RecTy(StringRecTyKind) {} - virtual void anchor(); public: static bool classof(const RecTy *RT) { return RT->getRecTyKind() == StringRecTyKind; @@ -147,7 +146,7 @@ public: static StringRecTy *get() { return &Shared; } - std::string getAsString() const override { return "string"; } + std::string getAsString() const override; }; /// ListRecTy - 'list' - Represent a list of values, all of which must be of @@ -177,7 +176,6 @@ class DagRecTy : public RecTy { static DagRecTy Shared; DagRecTy() : RecTy(DagRecTyKind) {} - virtual void anchor(); public: static bool classof(const RecTy *RT) { return RT->getRecTyKind() == DagRecTyKind; @@ -185,7 +183,7 @@ public: static DagRecTy *get() { return &Shared; } - std::string getAsString() const override { return "dag"; } + std::string getAsString() const override; }; /// RecordRecTy - '[classname]' - Represent an instance of a class, such as: diff --git a/lib/TableGen/Record.cpp b/lib/TableGen/Record.cpp index 6c7a66fcba1..3097c4ee33e 100644 --- a/lib/TableGen/Record.cpp +++ b/lib/TableGen/Record.cpp @@ -88,9 +88,6 @@ DagRecTy DagRecTy::Shared; void RecTy::dump() const { print(errs()); } -void StringRecTy::anchor() { } -void DagRecTy::anchor() { } - ListRecTy *RecTy::getListTy() { if (!ListTy) ListTy.reset(new ListRecTy(this)); @@ -136,6 +133,9 @@ bool IntRecTy::typeIsConvertibleTo(const RecTy *RHS) const { return kind==BitRecTyKind || kind==BitsRecTyKind || kind==IntRecTyKind; } +std::string StringRecTy::getAsString() const { + return "string"; +} std::string ListRecTy::getAsString() const { return "list<" + Ty->getAsString() + ">"; @@ -147,6 +147,10 @@ bool ListRecTy::typeIsConvertibleTo(const RecTy *RHS) const { return false; } +std::string DagRecTy::getAsString() const { + return "dag"; +} + RecordRecTy *RecordRecTy::get(Record *R) { return dyn_cast(R->getDefInit()->getType()); } -- 2.34.1