Author: Owen Pan Date: 2023-07-11T17:05:00-07:00 New Revision: 875b881186c4eb146e77e76ad72ee0a356d7c69f
URL: https://github.com/llvm/llvm-project/commit/875b881186c4eb146e77e76ad72ee0a356d7c69f DIFF: https://github.com/llvm/llvm-project/commit/875b881186c4eb146e77e76ad72ee0a356d7c69f.diff LOG: [clang-format][NFC] Remove redundant parentheses in the source code Reformat the source code with RemoveParentheses set to ReturnStatement. Added: Modified: clang/lib/Format/ContinuationIndenter.cpp clang/lib/Format/DefinitionBlockSeparator.cpp clang/lib/Format/QualifierAlignmentFixer.cpp clang/lib/Format/TokenAnnotator.cpp clang/lib/Format/UnwrappedLineFormatter.cpp Removed: ################################################################################ diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 66e66cc6856d8c..0ca297a5f95768 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -617,10 +617,10 @@ unsigned ContinuationIndenter::addTokenToState(LineState &State, bool Newline, assert(!State.Stack.empty()); State.NoContinuation = false; - if ((Current.is(TT_ImplicitStringLiteral) && - (!Previous.Tok.getIdentifierInfo() || - Previous.Tok.getIdentifierInfo()->getPPKeywordID() == - tok::pp_not_keyword))) { + if (Current.is(TT_ImplicitStringLiteral) && + (!Previous.Tok.getIdentifierInfo() || + Previous.Tok.getIdentifierInfo()->getPPKeywordID() == + tok::pp_not_keyword)) { unsigned EndColumn = SourceMgr.getSpellingColumnNumber(Current.WhitespaceRange.getEnd()); if (Current.LastNewlineOffset != 0) { diff --git a/clang/lib/Format/DefinitionBlockSeparator.cpp b/clang/lib/Format/DefinitionBlockSeparator.cpp index 5c006e2d037b29..576c6597b27afe 100644 --- a/clang/lib/Format/DefinitionBlockSeparator.cpp +++ b/clang/lib/Format/DefinitionBlockSeparator.cpp @@ -52,10 +52,10 @@ void DefinitionBlockSeparator::separateBlocks( for (const FormatToken *CurrentToken = Line->First; CurrentToken; CurrentToken = CurrentToken->Next) { if (BracketLevel == 0) { - if ((CurrentToken->isOneOf(tok::kw_class, tok::kw_struct, - tok::kw_union) || - (Style.isJavaScript() && - CurrentToken->is(ExtraKeywords.kw_function)))) { + if (CurrentToken->isOneOf(tok::kw_class, tok::kw_struct, + tok::kw_union) || + (Style.isJavaScript() && + CurrentToken->is(ExtraKeywords.kw_function))) { return true; } if (!ExcludeEnum && CurrentToken->is(tok::kw_enum)) @@ -164,7 +164,7 @@ void DefinitionBlockSeparator::separateBlocks( } } - if ((Style.isCSharp() && OperateLine->First->is(TT_AttributeSquare))) + if (Style.isCSharp() && OperateLine->First->is(TT_AttributeSquare)) return true; return false; }; diff --git a/clang/lib/Format/QualifierAlignmentFixer.cpp b/clang/lib/Format/QualifierAlignmentFixer.cpp index 2e3b21cfda79eb..86f62dc2eec91a 100644 --- a/clang/lib/Format/QualifierAlignmentFixer.cpp +++ b/clang/lib/Format/QualifierAlignmentFixer.cpp @@ -618,7 +618,7 @@ bool LeftRightQualifierAlignmentFixer::isPossibleMacro(const FormatToken *Tok) { return false; if (Tok->TokenText.upper() == Tok->TokenText.str()) { // T,K,U,V likely could be template arguments - return (Tok->TokenText.size() != 1); + return Tok->TokenText.size() != 1; } return false; } diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 7bec899754362d..52973a3ec95171 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -2955,8 +2955,8 @@ class ExpressionParser { Tok = Next; if (Tok) Tok = Tok->getNextNonComment(); - } else if ((Keywords.isVerilogQualifier(*Tok) || - Keywords.isVerilogIdentifier(*Tok))) { + } else if (Keywords.isVerilogQualifier(*Tok) || + Keywords.isVerilogIdentifier(*Tok)) { First = Tok; Tok = Next; // The name may have dots like `interface_foo.modport_foo`. diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp index 3eacd0201df326..9413dbe59553bd 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.cpp +++ b/clang/lib/Format/UnwrappedLineFormatter.cpp @@ -116,8 +116,8 @@ class LevelIndentTracker { return true; } // Handle Qt signals. - else if ((RootToken.isOneOf(Keywords.kw_signals, Keywords.kw_qsignals) && - RootToken.Next && RootToken.Next->is(tok::colon))) { + else if (RootToken.isOneOf(Keywords.kw_signals, Keywords.kw_qsignals) && + RootToken.Next && RootToken.Next->is(tok::colon)) { return true; } else if (RootToken.Next && RootToken.Next->isOneOf(Keywords.kw_slots, _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits