File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
lib/Tools/mlir-lsp-server Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,14 @@ class OwningOpRef {
49
49
// / Allow accessing the internal op.
50
50
OpTy get () const { return op; }
51
51
OpTy operator *() const { return op; }
52
- OpTy *operator ->() { return &op; }
52
+ auto operator ->() {
53
+ // Specialize for the case where OpTy is a pointer, to allow using
54
+ // OwningOpRef<Operation*>.
55
+ if constexpr (std::is_pointer<OpTy>::value)
56
+ return op;
57
+ else
58
+ return &op;
59
+ }
53
60
explicit operator bool () const { return op; }
54
61
55
62
// / Downcast to generic operation.
Original file line number Diff line number Diff line change @@ -1322,13 +1322,13 @@ lsp::MLIRServer::convertFromBytecode(const URIForFile &uri) {
1322
1322
// Extract the top-level op so that aliases get printed.
1323
1323
// FIXME: We should be able to enable aliases without having to do this!
1324
1324
OwningOpRef<Operation *> topOp = &parsedBlock.front ();
1325
- (* topOp) ->remove ();
1325
+ topOp->remove ();
1326
1326
1327
1327
AsmState state (*topOp, OpPrintingFlags ().enableDebugInfo ().assumeVerified (),
1328
1328
/* locationMap=*/ nullptr , &fallbackResourceMap);
1329
1329
1330
1330
llvm::raw_string_ostream os (result.output );
1331
- (* topOp) ->print (os, state);
1331
+ topOp->print (os, state);
1332
1332
}
1333
1333
return std::move (result);
1334
1334
}
You can’t perform that action at this time.
0 commit comments