[clang] [clang-format] Don't break module names (PR #193834)

via cfe-commits cfe-commits at lists.llvm.org
Sun May 3 20:24:10 PDT 2026


=?utf-8?q?Björn_Schäpers?= <bjoern at hazardy.de>,
=?utf-8?q?Björn_Schäpers?= <bjoern at hazardy.de>,
=?utf-8?q?Björn_Schäpers?= <bjoern at hazardy.de>,
=?utf-8?q?Björn_Schäpers?= <bjoern at hazardy.de>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/193834 at github.com>


owenca wrote:

> I don't see the need for `parseModuleDeclaration` or similar, `parseModuleImport` was added solely for C++.

Why not annotate the line with `IsModuleOrImportDecl` as suggested (or with a new `TT_ModuleOrImportDecl` on `module` and `import`) when parsing the line in `UnwrappedLineParser` and then use the annotation in `TokenAnnotator` rather than "parsing" the line again in `isCppModuleLine`? (That's why I think we should add a `parseModuleDeclaration` in the parser.)

Also, if we set `CanBreakBefore` to `false` in the annotator, we don't need to touch `UnwrappedLineFormatter`.

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


More information about the cfe-commits mailing list