This is an archive of the discontinued LLVM Phabricator instance.

[TableGen] add !toupper and !tolower operators to change the casing of strings.
ClosedPublic

Authored by zjaffal on Mar 4 2023, 12:30 AM.

Diff Detail

Unit TestsFailed

Event Timeline

zjaffal created this revision.Mar 4 2023, 12:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2023, 12:30 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
zjaffal requested review of this revision.Mar 4 2023, 12:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2023, 12:30 AM
zjaffal updated this revision to Diff 502360.Mar 4 2023, 12:33 AM

Remove wrong linting

Thanks for doing this.

Don't we want to call them !toupper and !tolower, to match C++?

Thanks for doing this.

Don't we want to call them !toupper and !tolower, to match C++?

yeah that would be a good idea I will update them

zjaffal updated this revision to Diff 502375.Mar 4 2023, 8:58 AM

change bang operators to be !toupper and !tolower

zjaffal retitled this revision from [TableGen] add !upper and !lower operators to change the casing of strings. to [TableGen] add !toupper and !tolower operators to change the casing of strings..Mar 4 2023, 8:58 AM

Thank you @zjaffal for working on this.

Please update also the docs at https://llvm.org/docs/TableGen/ProgRef.html

Francesco

llvm/test/TableGen/string_ops.td
32

Unless there are compelling reasons for redirecting the test via !eq and !if, may I ask you to test the new operators directly? Something along the lines of:

class ToLower<string str> {
  string s = !tolower(str)
}

// CHECK-LABEL: def TEST1 {
// CHECK: string ="str";
// CHECK: }
def  TEST1: ToLower<"sTr">;

(something similar for !toupper)

Thank you @zjaffal for working on this.

Please update also the docs at https://llvm.org/docs/TableGen/ProgRef.html

Wouldn't that page be updated if I update TableGen/ProgRef.rst ?

Thank you @zjaffal for working on this.

Please update also the docs at https://llvm.org/docs/TableGen/ProgRef.html

Wouldn't that page be updated if I update TableGen/ProgRef.rst ?

Yep - my bad, I missed it. I should have taken another coffee before reviewing this patch. :)

Francesco

zjaffal updated this revision to Diff 502971.Mar 7 2023, 3:01 AM

edit the test to check for the string instead of using !eq

fpetrogalli accepted this revision.Mar 7 2023, 4:01 AM

LGTM, with a minor comments on the docs, to make somehow explicit that these new operators accept only string in input.

Thank you!

Francesco

llvm/docs/TableGen/ProgRef.rst
1634
1637
This revision is now accepted and ready to land.Mar 7 2023, 4:01 AM
zjaffal updated this revision to Diff 502989.Mar 7 2023, 4:40 AM

fix ProgRef.rst to indicate that the new operators only work for strings

This revision was landed with ongoing or failed builds.Mar 7 2023, 4:42 AM
This revision was automatically updated to reflect the committed changes.