diff options
| author | Nicolas Vasilache <ntv@google.com> | 2019-12-13 17:16:19 -0800 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-12-13 17:51:15 -0800 |
| commit | 3ef15a80d2b0647e62771b5adc6e6f639e58f8b3 (patch) | |
| tree | af8d688148e7683978eacb9f1769411d920fa74a /mlir | |
| parent | 200beb84461bd249589913a3d89898a9c6e588b9 (diff) | |
| download | bcm5719-llvm-3ef15a80d2b0647e62771b5adc6e6f639e58f8b3.tar.gz bcm5719-llvm-3ef15a80d2b0647e62771b5adc6e6f639e58f8b3.zip | |
Reconcile struct and class for NestedPatternMatchers - NFC
This removes a warning and fixes a potential ABI issue on Windows.
PiperOrigin-RevId: 285502010
Diffstat (limited to 'mlir')
| -rw-r--r-- | mlir/include/mlir/Analysis/NestedMatcher.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/mlir/include/mlir/Analysis/NestedMatcher.h b/mlir/include/mlir/Analysis/NestedMatcher.h index dd4022a2617..9af26e8842a 100644 --- a/mlir/include/mlir/Analysis/NestedMatcher.h +++ b/mlir/include/mlir/Analysis/NestedMatcher.h @@ -24,7 +24,7 @@ namespace mlir { -struct NestedPattern; +class NestedPattern; class Operation; /// An NestedPattern captures nested patterns in the IR. @@ -52,7 +52,8 @@ class Operation; /// A NestedMatch contains an Operation* and the children NestedMatch and is /// thus cheap to copy. NestedMatch is stored in a scoped bumper allocator whose /// lifetime is managed by an RAII NestedPatternContext. -struct NestedMatch { +class NestedMatch { +public: static NestedMatch build(Operation *operation, ArrayRef<NestedMatch> nestedMatches); NestedMatch(const NestedMatch &) = default; @@ -64,8 +65,8 @@ struct NestedMatch { ArrayRef<NestedMatch> getMatchedChildren() { return matchedChildren; } private: - friend struct NestedPattern; - friend struct NestedPatternContext; + friend class NestedPattern; + friend class NestedPatternContext; /// Underlying global bump allocator managed by a NestedPatternContext. static llvm::BumpPtrAllocator *&allocator(); @@ -97,7 +98,8 @@ private: /// implementation is competitive nonetheless. using FilterFunctionType = std::function<bool(Operation &)>; inline bool defaultFilterFunction(Operation &) { return true; } -struct NestedPattern { +class NestedPattern { +public: NestedPattern(ArrayRef<NestedPattern> nested, FilterFunctionType filter = defaultFilterFunction); NestedPattern(const NestedPattern &) = default; @@ -117,8 +119,8 @@ struct NestedPattern { unsigned getDepth() const; private: - friend struct NestedPatternContext; - friend struct NestedMatch; + friend class NestedPatternContext; + friend class NestedMatch; friend struct State; /// Underlying global bump allocator managed by a NestedPatternContext. @@ -153,7 +155,8 @@ private: /// RAII structure to transparently manage the bump allocator for /// NestedPattern and NestedMatch classes. This avoids passing a context to /// all the API functions. -struct NestedPatternContext { +class NestedPatternContext { +public: NestedPatternContext() { assert(NestedMatch::allocator() == nullptr && "Only a single NestedPatternContext is supported"); |

