This is an archive of the discontinued LLVM Phabricator instance.

Use more references in Diagnostic handling (NFC)
ClosedPublic

Authored by mehdi_amini on Jan 17 2022, 4:53 PM.

Details

Summary

This saves some copies of non-trivial objects.

Diff Detail

Event Timeline

mehdi_amini created this revision.Jan 17 2022, 4:53 PM
mehdi_amini requested review of this revision.Jan 17 2022, 4:53 PM
rriddle added inline comments.Jan 17 2022, 4:57 PM
mlir/include/mlir/IR/Diagnostics.h
433–436

This should also now indicate that diag may be consumed during emission, i.e. you can't rely on it being the same after this call.

Internally here we were moving these, were the additional copies outside here/from user code invocation?

mlir/include/mlir/IR/Diagnostics.h
433–436

Should we (and this would be more invasive ...) make this as rvalue to make it clear at call site that this is the case? Ref does indicate it can be modified but sounds like the expectation of the user should be more akin to what post move variable is.

Use r-values in the APIs (should we also update the handlers?)

mehdi_amini marked 2 inline comments as done.Jan 17 2022, 5:59 PM
rriddle accepted this revision.Jan 17 2022, 10:16 PM

Use of r-value on user facing API LG.

should we also update the handlers?

A specific handler isn't guaranteed to completely handle a diagnostic, and can signal to the diagnostic engine that the diagnostic should be passed on to the next registered handler.

This revision is now accepted and ready to land.Jan 17 2022, 10:16 PM
This revision was landed with ongoing or failed builds.Jan 17 2022, 10:45 PM
This revision was automatically updated to reflect the committed changes.
bondhugula retitled this revision from Use more references in Diagnotic handling (NFC) to Use more references in Diagnostic handling (NFC).Jan 18 2022, 2:41 AM