This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Generate C++ doc comments for interfaces
ClosedPublic

Authored by ftynse on Jul 25 2022, 6:03 AM.

Details

Summary

When emitting the declarations for interface methods defined in ODS,
also emit their descriptions as C++ comments. This makes the
documentation accessible to C++ tooling such as IDEs that offers better
usability than reading it form the .td or the website.

Diff Detail

Event Timeline

ftynse created this revision.Jul 25 2022, 6:03 AM
ftynse requested review of this revision.Jul 25 2022, 6:03 AM
jpienaar added inline comments.Jul 25 2022, 1:20 PM
mlir/tools/mlir-tblgen/DocGenUtilities.h
17

Is this required?

mlir/tools/mlir-tblgen/OpDocGen.cpp
66

Why not just use raw_indented_ostream and then set prefix before? (this function could also effectively be printReindented if that allowed for specifying a prefix of "/// ")

mlir/tools/mlir-tblgen/OpInterfacesGen.cpp
412

If you switched, then you could also get rid of keeping manual track of lists of spaces everywhere.

ftynse updated this revision to Diff 447645.Jul 26 2022, 4:39 AM
ftynse marked an inline comment as done.

Address review.

ftynse marked an inline comment as done.Jul 26 2022, 4:39 AM
ftynse added inline comments.
mlir/tools/mlir-tblgen/DocGenUtilities.h
17

Yes. Default-valued argument below needs full type definition.

jpienaar accepted this revision.Aug 9 2022, 8:36 AM

Thanks!

This revision is now accepted and ready to land.Aug 9 2022, 8:36 AM
This revision was automatically updated to reflect the committed changes.