This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Surround array attributes with square brackets when parsing/printing.
AbandonedPublic

Authored by csigg on Jun 14 2022, 4:13 AM.

Details

Reviewers
rriddle
Mogball
Summary

Note: the type detection is different for the parser (has a push_back method) and printer (is an ArrayRef<T>).

Alternatively, one could override the parser/printer just for ArrayRefParameter. Please let me know if that's preferred.

Diff Detail

Event Timeline

csigg created this revision.Jun 14 2022, 4:13 AM
Herald added a project: Restricted Project. · View Herald Transcript
csigg requested review of this revision.Jun 14 2022, 4:13 AM
csigg updated this revision to Diff 436753.Jun 14 2022, 5:48 AM

Remove unused functions, fix test.

Mogball requested changes to this revision.Jun 14 2022, 9:57 AM
Mogball added a subscriber: Mogball.

I don't think this is something generically applicable. If you want a specific array parameter to be parsed with surrounding square brackets inside of struct(params), then I would recommend you just alter the parser and printer of that parameter instead of changing it for all array parameters:

def SquareBracketArrayParameter : AttrParameter<...> {
  let parser = "parseSquareBracketArray(...)";
  let printer = "printSquareBracketArray(...)";
}
This revision now requires changes to proceed.Jun 14 2022, 9:57 AM
csigg abandoned this revision.Jun 20 2022, 11:38 PM