ClangSharp icon indicating copy to clipboard operation
ClangSharp copied to clipboard

Add regex support to remapping and attributes

Open TareHimself opened this issue 5 months ago • 1 comments

Fixes https://github.com/dotnet/ClangSharp/issues/614 This PR does not include tests. I created it to determine if the repo will allow regex for --remap and --with-attributes. regex support is opt-in using a separate --remap-regex and --with-attributes-regex , --remap-regex supports string formatting. These are some examples

--remap-regex
^([\w\d]+)Flags([0-9])$={0}Flags{1}
^([\w\d]+)FlagBits$=@{0}Flags

--with-attribute-regex
^Vk[\w\d]+Flags$=Flags
^Vk[\w\d]+Flags[0-9]$=Flags

if allowed I will start working on tests and this can also be added to --with-type as --with-type-regex

TareHimself avatar Jul 14 '25 03:07 TareHimself

Can you elaborate on the use case for this?

What are you hitting that requires full regex support and where the existing basic wildcard support is not sufficient?

Supporting arbitrary external regex inputs is potentially dangerous and not something I'm keen on doing. I'm happy to do limited additional extensions to the existing remapping feature, however.

tannergooding avatar Jul 17 '25 17:07 tannergooding