llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-format Author: Damian Höster (damster101) <details> <summary>Changes</summary> 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`. --- Full diff: https://github.com/llvm/llvm-project/pull/204565.diff 1 Files Affected: - (modified) clang/lib/Format/UnwrappedLineParser.cpp (+1) ``````````diff 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; `````````` </details> https://github.com/llvm/llvm-project/pull/204565 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
