KitsuneAlex updated this revision to Diff 529798. KitsuneAlex added a comment.
Some additional changes because i exceeded the maximum line width on multiple occasions. Herald added a comment. NOTE: Clang-Format Team Automated Review Comment Your review contains a change to clang/include/clang/Format/Format.h but does not contain an update to ClangFormatStyleOptions.rst ClangFormatStyleOptions.rst is generated via clang/docs/tools/dump_format_style.py, please run this to regenerate the .rst You can validate that the rst is valid by running. ./docs/tools/dump_format_style.py mkdir -p html /usr/bin/sphinx-build -n ./docs ./html Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D152443/new/ https://reviews.llvm.org/D152443 Files: clang/include/clang/Format/Format.h clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/FormatTest.cpp Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -22904,7 +22904,6 @@ TEST_F(FormatTest, SpaceAfterOperatorKeyword) { FormatStyle Style = getLLVMStyle(); verifyFormat("bool operator==();", Style); - Style.SpaceAfterOperatorKeyword = true; verifyFormat("bool operator ==();", Style); } @@ -22913,7 +22912,6 @@ FormatStyle Style = getLLVMStyle(); verifyFormat("foo.operator==();", Style); verifyFormat("foo.Foo::operator==();", Style); - Style.SpaceAfterOperatorKeywordInCall = true; verifyFormat("foo.operator ==();", Style); verifyFormat("foo.Foo::operator ==();", Style); Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -4201,13 +4201,13 @@ // Space in __attribute__((attr)) ::type. if (Left.is(TT_AttributeParen) && Right.is(tok::coloncolon)) return true; - if (Left.is(tok::kw_operator)) { - if (Left.Previous && Left.Previous->isOneOf(tok::coloncolon, tok::period)) - return Style.SpaceAfterOperatorKeywordInCall || Right.is(tok::coloncolon); + if (Left.Previous && + Left.Previous->isOneOf(tok::coloncolon, tok::period)) + return Style.SpaceAfterOperatorKeywordInCall || + Right.is(tok::coloncolon); return Style.SpaceAfterOperatorKeyword || Right.is(tok::coloncolon); } - if (Right.is(tok::l_brace) && Right.is(BK_BracedInit) && !Left.opensScope() && Style.SpaceBeforeCpp11BracedList) { return true; Index: clang/include/clang/Format/Format.h =================================================================== --- clang/include/clang/Format/Format.h +++ clang/include/clang/Format/Format.h @@ -3701,7 +3701,6 @@ bool SpaceAfterOperatorKeyword; /// If \c true, a space will be inserted after the 'operator' keyword in a call expression. - /// This option defaults to SpaceAfterOperatorKeyword. /// \code /// true: false: /// foo.operator ==(...); vs. foo.operator==(...); @@ -4430,7 +4429,8 @@ SpaceAfterCStyleCast == R.SpaceAfterCStyleCast && SpaceAfterLogicalNot == R.SpaceAfterLogicalNot && SpaceAfterOperatorKeyword == R.SpaceAfterOperatorKeyword && - SpaceAfterOperatorKeywordInCall == R.SpaceAfterOperatorKeywordInCall && + SpaceAfterOperatorKeywordInCall == + R.SpaceAfterOperatorKeywordInCall && SpaceAfterTemplateKeyword == R.SpaceAfterTemplateKeyword && SpaceBeforeAssignmentOperators == R.SpaceBeforeAssignmentOperators && SpaceBeforeCaseColon == R.SpaceBeforeCaseColon &&
Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -22904,7 +22904,6 @@ TEST_F(FormatTest, SpaceAfterOperatorKeyword) { FormatStyle Style = getLLVMStyle(); verifyFormat("bool operator==();", Style); - Style.SpaceAfterOperatorKeyword = true; verifyFormat("bool operator ==();", Style); } @@ -22913,7 +22912,6 @@ FormatStyle Style = getLLVMStyle(); verifyFormat("foo.operator==();", Style); verifyFormat("foo.Foo::operator==();", Style); - Style.SpaceAfterOperatorKeywordInCall = true; verifyFormat("foo.operator ==();", Style); verifyFormat("foo.Foo::operator ==();", Style); Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -4201,13 +4201,13 @@ // Space in __attribute__((attr)) ::type. if (Left.is(TT_AttributeParen) && Right.is(tok::coloncolon)) return true; - if (Left.is(tok::kw_operator)) { - if (Left.Previous && Left.Previous->isOneOf(tok::coloncolon, tok::period)) - return Style.SpaceAfterOperatorKeywordInCall || Right.is(tok::coloncolon); + if (Left.Previous && + Left.Previous->isOneOf(tok::coloncolon, tok::period)) + return Style.SpaceAfterOperatorKeywordInCall || + Right.is(tok::coloncolon); return Style.SpaceAfterOperatorKeyword || Right.is(tok::coloncolon); } - if (Right.is(tok::l_brace) && Right.is(BK_BracedInit) && !Left.opensScope() && Style.SpaceBeforeCpp11BracedList) { return true; Index: clang/include/clang/Format/Format.h =================================================================== --- clang/include/clang/Format/Format.h +++ clang/include/clang/Format/Format.h @@ -3701,7 +3701,6 @@ bool SpaceAfterOperatorKeyword; /// If \c true, a space will be inserted after the 'operator' keyword in a call expression. - /// This option defaults to SpaceAfterOperatorKeyword. /// \code /// true: false: /// foo.operator ==(...); vs. foo.operator==(...); @@ -4430,7 +4429,8 @@ SpaceAfterCStyleCast == R.SpaceAfterCStyleCast && SpaceAfterLogicalNot == R.SpaceAfterLogicalNot && SpaceAfterOperatorKeyword == R.SpaceAfterOperatorKeyword && - SpaceAfterOperatorKeywordInCall == R.SpaceAfterOperatorKeywordInCall && + SpaceAfterOperatorKeywordInCall == + R.SpaceAfterOperatorKeywordInCall && SpaceAfterTemplateKeyword == R.SpaceAfterTemplateKeyword && SpaceBeforeAssignmentOperators == R.SpaceBeforeAssignmentOperators && SpaceBeforeCaseColon == R.SpaceBeforeCaseColon &&
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits