From 485cf19651a5710159493e678835ba02a3fc21cb Mon Sep 17 00:00:00 2001 From: Stella Laurenzo Date: Sun, 19 Apr 2020 19:12:39 -0700 Subject: [PATCH] Define SDBM key methods in its own cpp file. Summary: * Follows the convention of the tablegen-generated dialects. * Ensures that vague linkage rules place the definitions in the dialect's object files. * Allows code that uses RTTI to include MLIR headers (compiled without RTTI) without type_info link errors. Reviewers: rriddle Reviewed By: rriddle Subscribers: mgorny, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, grosul1, frgossen, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D78039 --- mlir/include/mlir/Dialect/SDBM/SDBMDialect.h | 5 +++++ mlir/lib/Dialect/SDBM/CMakeLists.txt | 1 + mlir/lib/Dialect/SDBM/SDBMDialect.cpp | 13 +++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 mlir/lib/Dialect/SDBM/SDBMDialect.cpp diff --git a/mlir/include/mlir/Dialect/SDBM/SDBMDialect.h b/mlir/include/mlir/Dialect/SDBM/SDBMDialect.h index 60f2692..0993b43 100644 --- a/mlir/include/mlir/Dialect/SDBM/SDBMDialect.h +++ b/mlir/include/mlir/Dialect/SDBM/SDBMDialect.h @@ -19,6 +19,11 @@ class SDBMDialect : public Dialect { public: SDBMDialect(MLIRContext *context) : Dialect(getDialectNamespace(), context) {} + /// Since there are no other virtual methods in this derived class, override + /// the destructor so that key methods get defined in the corresponding + /// module. + ~SDBMDialect() override; + static StringRef getDialectNamespace() { return "sdbm"; } /// Get the uniquer for SDBM expressions. This should not be used directly. diff --git a/mlir/lib/Dialect/SDBM/CMakeLists.txt b/mlir/lib/Dialect/SDBM/CMakeLists.txt index 64d58c6..6f5a119 100644 --- a/mlir/lib/Dialect/SDBM/CMakeLists.txt +++ b/mlir/lib/Dialect/SDBM/CMakeLists.txt @@ -1,5 +1,6 @@ add_mlir_dialect_library(MLIRSDBM SDBM.cpp + SDBMDialect.cpp SDBMExpr.cpp ADDITIONAL_HEADER_DIRS diff --git a/mlir/lib/Dialect/SDBM/SDBMDialect.cpp b/mlir/lib/Dialect/SDBM/SDBMDialect.cpp new file mode 100644 index 0000000..6306063 --- /dev/null +++ b/mlir/lib/Dialect/SDBM/SDBMDialect.cpp @@ -0,0 +1,13 @@ +//===- SDBMDialect.cpp - MLIR SDBM Dialect --------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "mlir/Dialect/SDBM/SDBMDialect.h" + +using namespace mlir; + +SDBMDialect::~SDBMDialect() = default; -- 2.7.4