[PATCH] D120712: [clang-format][docs] handle explicit enum values
Konrad Wilhelm Kleine via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 1 07:27:26 PST 2022
kwk added inline comments.
================
Comment at: clang/docs/tools/dump_format_style.py:174-175
return '* ``%s`` (in configuration: ``%s``)\n%s' % (
- self.name,
- re.sub('.*_', '', self.config),
+ self.clean_name,
+ self.clean_config,
doxygen2rst(indent(self.comment, 2)))
----------------
MyDeveloperDay wrote:
> Feels like there is repetition here
Are you suggesting to introduce a function `name_only` that looks like this?
```lang=python
def name_only(s: str) -> str:
return s.split("=", 1)[0].strip()
```
If so, should this be a member function of `EnumValue` or where would you see it?
I'm not fond of introducing this function TBH because the name suggest it to be very generically usable when in fact it does just a simple thing. If you pass `foo and bar` to it you get `foo and bar` but that's not a usable name of any kind, right?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120712/new/
https://reviews.llvm.org/D120712
More information about the cfe-commits
mailing list