[all-commits] [llvm/llvm-project] 50cd52: [clang-format] Fix WhitespaceSensitiveMacros not b...
Marek Kurdej via All-commits
all-commits at lists.llvm.org
Mon May 9 01:59:40 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 50cd52d9357224cce66a9e00c9a0417c658a5655
https://github.com/llvm/llvm-project/commit/50cd52d9357224cce66a9e00c9a0417c658a5655
Author: Marek Kurdej <marek.kurdej+llvm.org at gmail.com>
Date: 2022-05-09 (Mon, 09 May 2022)
Changed paths:
M clang/lib/Format/FormatTokenLexer.cpp
M clang/lib/Format/UnwrappedLineParser.cpp
M clang/unittests/Format/FormatTest.cpp
Log Message:
-----------
[clang-format] Fix WhitespaceSensitiveMacros not being honoured when macro closing parenthesis is followed by a newline.
Fixes https://github.com/llvm/llvm-project/issues/54522.
This fixes regression introduced in https://github.com/llvm/llvm-project/commit/5e5efd8a91f2e340e79a73bedbc6ab66ad4a4281.
Before the culprit commit, macros in WhitespaceSensitiveMacros were correctly formatted even if their closing parenthesis weren't followed by semicolon (or, to be precise, when they were followed by a newline).
That commit changed the type of the macro token type from TT_UntouchableMacroFunc to TT_FunctionLikeOrFreestandingMacro.
Correct formatting (with `WhitespaceSensitiveMacros = ['FOO']`):
```
FOO(1+2)
FOO(1+2);
```
Regressed formatting:
```
FOO(1 + 2)
FOO(1+2);
```
Reviewed By: HazardyKnusperkeks, owenpan, ksyx
Differential Revision: https://reviews.llvm.org/D123676
More information about the All-commits
mailing list