1 //===- Attributes.cpp - MLIR Affine Expr Classes --------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "mlir/IR/Attributes.h"
10 #include "mlir/IR/Dialect.h"
11 
12 using namespace mlir;
13 using namespace mlir::detail;
14 
15 //===----------------------------------------------------------------------===//
16 // Attribute
17 //===----------------------------------------------------------------------===//
18 
19 /// Return the context this attribute belongs to.
20 MLIRContext *Attribute::getContext() const { return getDialect().getContext(); }
21 
22 //===----------------------------------------------------------------------===//
23 // NamedAttribute
24 //===----------------------------------------------------------------------===//
25 
26 bool mlir::operator<(const NamedAttribute &lhs, const NamedAttribute &rhs) {
27   return lhs.first.compare(rhs.first) < 0;
28 }
29 bool mlir::operator<(const NamedAttribute &lhs, StringRef rhs) {
30   return lhs.first.getValue().compare(rhs) < 0;
31 }
32