llvm-project
11cbbb97 - [clang-format] Prevent line comment continuation across formatting-disabled boundary (#233414)

Commit
4 days ago
[clang-format] Prevent line comment continuation across formatting-disabled boundary (#233414) Fixes #222510 ### Cause - `OneLineFormatOffRegex` matching the trailing comment on a nested `#else` directive allows the following enabled line comment to be treated as continuation of that formatting-disabled comment - With tabs and the original nested preprocessor reproducer, repeated formatting oscillates between two tabs and one tab ### Approach - In `clang/lib/Format/FormatToken.h`, make `continuesLineComment` return false when `FormatTok.Finalized != Previous->Finalized` after the existing null checks - Prevent comment grouping across formatting-enabled and formatting-disabled boundaries without changing same-state behavior
Author
Parents
Loading