[Mlir-commits] [mlir] 2141705 - Fix operator!= for Dialects.
Mehdi Amini
llvmlistbot at llvm.org
Thu Sep 10 12:18:35 PDT 2020
Author: Federico Lebrón
Date: 2020-09-10T19:18:24Z
New Revision: 2141705337989195b448e292955f08884babbcbd
URL: https://github.com/llvm/llvm-project/commit/2141705337989195b448e292955f08884babbcbd
DIFF: https://github.com/llvm/llvm-project/commit/2141705337989195b448e292955f08884babbcbd.diff
LOG: Fix operator!= for Dialects.
Currently the global operator!=(bool, bool) is selected due to the implicit bool
conversion operator. Since this is never the desired semantics, we give it a
standard operator!= and make the bool conversion explicit.
Depends On D86809
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D86810
Added:
Modified:
mlir/include/mlir/TableGen/Dialect.h
Removed:
################################################################################
diff --git a/mlir/include/mlir/TableGen/Dialect.h b/mlir/include/mlir/TableGen/Dialect.h
index 623d614d26d3..ee86a2504b3c 100644
--- a/mlir/include/mlir/TableGen/Dialect.h
+++ b/mlir/include/mlir/TableGen/Dialect.h
@@ -67,11 +67,13 @@ class Dialect {
// underlying record.
bool operator==(const Dialect &other) const;
+ bool operator!=(const Dialect &other) const { return !(*this == other); }
+
// Compares two dialects by comparing the names of the dialects.
bool operator<(const Dialect &other) const;
// Returns whether the dialect is defined.
- operator bool() const { return def != nullptr; }
+ explicit operator bool() const { return def != nullptr; }
private:
const llvm::Record *def;
More information about the Mlir-commits
mailing list