Define SDBM key methods in its own cpp file.
authorStella Laurenzo <stellaraccident@gmail.com>
Mon, 20 Apr 2020 02:12:39 +0000 (19:12 -0700)
committerStella Laurenzo <stellaraccident@gmail.com>
Sat, 25 Apr 2020 02:05:55 +0000 (19:05 -0700)
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
mlir/lib/Dialect/SDBM/CMakeLists.txt
mlir/lib/Dialect/SDBM/SDBMDialect.cpp [new file with mode: 0644]

index 60f2692..0993b43 100644 (file)
@@ -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.
index 64d58c6..6f5a119 100644 (file)
@@ -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 (file)
index 0000000..6306063
--- /dev/null
@@ -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;