[PATCH] D78039: Define SDBM key methods in its own cpp file.

Stella Laurenzo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 10:45:07 PDT 2020


stellaraccident created this revision.
Herald added subscribers: llvm-commits, frgossen, grosul1, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini, mgorny.
Herald added a project: LLVM.
stellaraccident updated this revision to Diff 257021.
stellaraccident added a comment.
stellaraccident added a reviewer: rriddle.
stellaraccident updated this revision to Diff 257023.

Installed clang-format.


stellaraccident added a comment.

Update comment.


- 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78039

Files:
  mlir/include/mlir/Dialect/SDBM/SDBMDialect.h
  mlir/lib/Dialect/SDBM/CMakeLists.txt
  mlir/lib/Dialect/SDBM/SDBMDialect.cpp


Index: mlir/lib/Dialect/SDBM/SDBMDialect.cpp
===================================================================
--- /dev/null
+++ mlir/lib/Dialect/SDBM/SDBMDialect.cpp
@@ -0,0 +1,17 @@
+//===- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// Dialect level definitions.
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Dialect/SDBM/SDBMDialect.h"
+
+using namespace mlir;
+
+SDBMDialect::~SDBMDialect() = default;
Index: mlir/lib/Dialect/SDBM/CMakeLists.txt
===================================================================
--- mlir/lib/Dialect/SDBM/CMakeLists.txt
+++ mlir/lib/Dialect/SDBM/CMakeLists.txt
@@ -1,5 +1,6 @@
 add_mlir_dialect_library(MLIRSDBM
   SDBM.cpp
+  SDBMDialect.cpp
   SDBMExpr.cpp
 
   ADDITIONAL_HEADER_DIRS
Index: mlir/include/mlir/Dialect/SDBM/SDBMDialect.h
===================================================================
--- mlir/include/mlir/Dialect/SDBM/SDBMDialect.h
+++ mlir/include/mlir/Dialect/SDBM/SDBMDialect.h
@@ -19,6 +19,11 @@
 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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78039.257023.patch
Type: text/x-patch
Size: 1785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200413/61497d89/attachment.bin>


More information about the llvm-commits mailing list