llvm-project
228a353d - [clang-format] Fix repeated backslash insertion in macro line comments (#164300)

Commit
16 days ago
[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>
Author
Parents
Loading