diff options
author | Ruoyu Zhong <zhongruoyu@outlook.com> | 2025-10-22 05:12:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-10-21 23:12:28 +0200 |
commit | 228a353dc6e69419360e3017bbadda1919803529 (patch) | |
tree | 4224365e6ee60f3d82845972d2a846b3a323028f /clang/unittests/Tooling/Syntax/TreeTestBase.cpp | |
parent | 288ef04d2f19c5b0e4ce3cae450c63a365ab11e9 (diff) | |
download | llvm-228a353dc6e69419360e3017bbadda1919803529.zip llvm-228a353dc6e69419360e3017bbadda1919803529.tar.gz llvm-228a353dc6e69419360e3017bbadda1919803529.tar.bz2 |
[clang-format] Fix repeated backslash insertion in macro line comments (#164300)
Line comments in preprocessor directives were incorrectly marked as
continuing the directive, causing clang-format to add backslashes after
them on repeated runs. Backslashes appended after line comments in this
way do not continue the PP directive because the following line would
also become part of the comment.
Fix by unsetting `InPPDirective` in
`WhitespaceManager::replaceWhitespace` for line comments in two places:
when breaking lines and when formatting tokens on the same line. This
stops the spurious backslash insertion for both standalone line comments
after PP directives and trailing line comments after macro bodies.
Fixes https://github.com/llvm/llvm-project/issues/164282.
Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
Diffstat (limited to 'clang/unittests/Tooling/Syntax/TreeTestBase.cpp')
0 files changed, 0 insertions, 0 deletions