https://github.com/damster101 created https://github.com/llvm/llvm-project/pull/204565
The `IsModuleOrImportDecl` flag was not reset in `addUnwrappedLine`. Since the parser recycles the `Line` object, this flag remained `true` for all subsequent lines in the file, which disabled wrapping (`CanBreakBefore` in `TokenAnnotator.cpp`) for expression-level constructs after any C++20 module or import statement, causing some formatting rules to not be applied in places. This patch fixes the issue by resetting the flag to `false`. From d9997828c460931677dbb69eab12f5f44bcd2c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20H=C3=B6ster?= <[email protected]> Date: Wed, 17 Jun 2026 14:43:28 +0200 Subject: [PATCH] [clang-format] Reset Line->IsModuleOrImportDecl in addUnwrappedLine The `IsModuleOrImportDecl` flag was not reset in `addUnwrappedLine`. Since the parser recycles the `Line` object, this flag remained `true` for all subsequent lines in the file, which disabled wrapping (`CanBreakBefore` in `TokenAnnotator.cpp`) for expression-level constructs after any C++20 module or import statement. This patch fixes the issue by resetting the flag to `false` in `addUnwrappedLine()`. --- clang/lib/Format/UnwrappedLineParser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index c83e82674dee1..b3f239a3ee801 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -4718,6 +4718,7 @@ void UnwrappedLineParser::addUnwrappedLine(LineLevel AdjustLevel) { Line->FirstStartColumn = 0; Line->IsContinuation = false; Line->SeenDecltypeAuto = false; + Line->IsModuleOrImportDecl = false; if (ClosesWhitesmithsBlock && AdjustLevel == LineLevel::Remove) --Line->Level; _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
