Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D136480
#include <utility>
namespace mlir {
+class Operation;
/// This class acts as an owning reference to an op, and will automatically
/// destroy the held op on destruction if the held op is valid.
OpTy *operator->() { return &op; }
explicit operator bool() const { return op; }
+ /// Downcast to generic operation.
+ operator OwningOpRef<Operation *>() && { return release().getOperation(); }
+
/// Release the referenced op.
OpTy release() {
OpTy released(nullptr);
bool insertImplicitModule) {
if (insertImplicitModule) {
// TODO: Move implicit module logic out of 'parseSourceFile' and into here.
- return parseSourceFile<ModuleOp>(sourceMgr, config)
- .release()
- .getOperation();
+ return parseSourceFile<ModuleOp>(sourceMgr, config);
}
return parseSourceFile(sourceMgr, config);
}