[clang] [clang][NFC] Regroup declarations in `Parser` (PR #138511)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Wed May 7 09:12:35 PDT 2025


Endilll wrote:

> > > > 3. File has been formatted with clang-format, except for the grammar, because clang-format butchers it.
> > > 
> > > 
> > > Yeah, this problem comes up rather frequently, I wonder if clang-format can get some additional smarts to make that less of a challenge? CC @mydeveloperday @owenca
> > 
> > 
> > Maybe the `CommentPragmas` option can be of help here?
> 
> I think it might be nice to maybe add `EnableFormatComments`/`DisableFormatComments` as options to clang-format where users can list custom comment strings that enable/disable formatting. We could make use of that to disable formatting between `\verbatim`/`\endverbatim`, and it might also be useful for people coming from other formatters (e.g. CLion’s formatter uses `@formatter:off` and `@formatter:on` and also lets you define custom markers).
> 
> I could work on adding options for that if there is in any interest in this—though before I do, any other suggestions as to what the name of those options should be? Because renaming an option after it’s been added is a bit tedious iirc ;Þ

I think I prefer clang-format to understand what `\verbatim` is if one big `EnableFormatComments: true` is specified in the config, without manually listing it.

https://github.com/llvm/llvm-project/pull/138511


More information about the cfe-commits mailing list