[PATCH] D117520: [clang-format] Fix SeparateDefinitionBlocks issues
Björn Schäpers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 19 12:01:36 PST 2022
HazardyKnusperkeks added inline comments.
================
Comment at: clang/lib/Format/DefinitionBlockSeparator.cpp:120
const auto MayPrecedeDefinition = [&](const int Direction = -1) {
+ assert(Direction >= -1 && Direction <= 1);
const size_t OperateIndex = OpeningLineIndex + Direction;
----------------
Split into two asserts, then one would know which did not hold.
================
Comment at: clang/lib/Format/DefinitionBlockSeparator.cpp:134
+ OperateIndex + 1 < Lines.size()) {
+ // UnwrappedLineParser's recognition of free-standing macro like
+ // Q_OBJECT may also recognize some uppercased type names that may be
----------------
Shouldn't we set a type for such cases instead of repeating the detection code here?
================
Comment at: clang/lib/Format/DefinitionBlockSeparator.cpp:135
+ // UnwrappedLineParser's recognition of free-standing macro like
+ // Q_OBJECT may also recognize some uppercased type names that may be
+ // used as return type as that kind of macros, which is a bit hard to
----------------
As a Qt user who also wants to use your patch, please add a test for that case. ;)
================
Comment at: clang/unittests/Format/DefinitionBlockSeparatorTest.cpp:143
+ "\n"
+ " LONGTYPENAME\n"
+ " Foobar(int t, int p) {\n"
----------------
Maybe really use HRESULT? People will know what that should be.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117520/new/
https://reviews.llvm.org/D117520
More information about the cfe-commits
mailing list