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

via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 22:01:20 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>


================
@@ -24630,8 +24626,28 @@ TEST_F(FormatTest, Cpp20ModulesSupport) {
   verifyFormat("module", Style);
   verifyFormat("export", Style);
 
+  verifyFormat("module :private;", Style);
+  verifyFormat("import <Foo/Bar> /* comment */;", Style);
+  verifyFormat("import <Foo/Bar>; // Trailing comment", Style);
+
+  Style.ColumnLimit = 10;
+  verifyFormat("import Foo.Bar;", Style);
+  verifyFormat("export import Foo.Bar;", Style);
+  verifyFormat("export module Foo.Bar;", Style);
+  verifyFormat("import Foo.Bar:Baz;", Style);
+  verifyFormat("export import Foo.Bar:Baz;", Style);
----------------
owenca wrote:

Delete. Unlike module declarations, import decls can have either a module name or a partition name, but not both.

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


More information about the cfe-commits mailing list