[doc] Use table to list all attributes

For each attribute, list its MLIR type and description.

PiperOrigin-RevId: 231580353
This commit is contained in:
Lei Zhang 2019-01-30 06:02:57 -08:00 committed by jpienaar
parent 726dc08e4d
commit b7d2e32c84
1 changed files with 7 additions and 2 deletions

View File

@ -113,9 +113,14 @@ static void emitOpDoc(const RecordKeeper &recordKeeper, raw_ostream &os) {
// TODO: Attributes are only documented by TableGen name, with no further
// info. This should be improved.
os << "\n### Attributes:\n";
if (op.getNumAttributes() > 0) {
os << "| Attribute | MLIR Type | Description |\n"
<< "| :-------: | :-------: | ----------- |\n";
}
for (auto namedAttr : op.getAttributes()) {
os << "- `" << namedAttr.getName()
<< "`: " << namedAttr.attr.getDescription() << " attribute\n";
os << "| `" << namedAttr.getName() << "` | `"
<< namedAttr.attr.getStorageType() << "` | "
<< namedAttr.attr.getDescription() << " attribute |\n";
}
// Emit results.