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

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sun May 3 05:29:35 PDT 2026


HazardyKnusperkeks wrote:

So, I've:
* Added a new line type and left the `LT_ImportStatement` untouched (and unused for C++).
* Format this on one line.
* Moved the `IsCpp` handling of `export` and `import` to the top of their cases, since I think the majority of our users are on that path.
* Removed the comment handling inside of `<` and `>` in an import statement, that's not valid C++.
* Improved the `isCppModuleLine` detection.
* Kept the `TT_ImplicitStringLiteral` annotation, it does exactly what we want without adding the overhead of annotating the `<`, `>`, and `/` and handling them for their spaces.
* Renamed `parseModuleImport` to `parseCppModuleImport` to reflect the usage.

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

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


More information about the cfe-commits mailing list