diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2019-09-27 09:49:20 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2019-09-27 09:49:20 +0000 |
commit | 22929c361efd3edc4d6937ac6e30f2462ac3fa13 (patch) | |
tree | ad5cee8dfeab099246f1fe92e8dacf6d55a6ef58 /lib/Format/TokenAnnotator.cpp | |
parent | c40345368252e600c43281438c4ca7ce5aa92d56 (diff) | |
download | clang-22929c361efd3edc4d6937ac6e30f2462ac3fa13.tar.gz |
Revert r373056: [clang-format] Reference qualifiers in member templates causing extra indentation
Reason: this breaks unit tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373059 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/TokenAnnotator.cpp')
-rw-r--r-- | lib/Format/TokenAnnotator.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 918d5d3588..e584eec368 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -65,7 +65,7 @@ public: AnnotatingParser(const FormatStyle &Style, AnnotatedLine &Line, const AdditionalKeywords &Keywords) : Style(Style), Line(Line), CurrentToken(Line.First), AutoFound(false), - TrailingReturnFound(false), Keywords(Keywords) { + Keywords(Keywords) { Contexts.push_back(Context(tok::unknown, 1, /*IsExpression=*/false)); resetTokenMetadata(CurrentToken); } @@ -1389,10 +1389,7 @@ private: } else if (Current.is(tok::arrow) && AutoFound && Line.MustBeDeclaration && Current.NestingLevel == 0) { Current.Type = TT_TrailingReturnArrow; - TrailingReturnFound = true; - } else if (Current.is(tok::star) || - (Current.isOneOf(tok::amp, tok::ampamp) && - (!Line.MightBeFunctionDecl || TrailingReturnFound))) { + } else if (Current.isOneOf(tok::star, tok::amp, tok::ampamp)) { Current.Type = determineStarAmpUsage(Current, Contexts.back().CanBeExpression && Contexts.back().IsExpression, @@ -1415,8 +1412,6 @@ private: Current.Type = TT_ConditionalExpr; } } else if (Current.isBinaryOperator() && - !(Line.MightBeFunctionDecl && - Current.isOneOf(tok::amp, tok::ampamp)) && (!Current.Previous || Current.Previous->isNot(tok::l_square)) && (!Current.is(tok::greater) && Style.Language != FormatStyle::LK_TextProto)) { @@ -1491,12 +1486,10 @@ private: // colon after this, this is the only place which annotates the identifier // as a selector.) Current.Type = TT_SelectorName; - } else if (Current.isOneOf(tok::identifier, tok::kw_const, tok::amp, - tok::ampamp) && + } else if (Current.isOneOf(tok::identifier, tok::kw_const) && Current.Previous && !Current.Previous->isOneOf(tok::equal, tok::at) && - Line.MightBeFunctionDecl && !TrailingReturnFound && - Contexts.size() == 1) { + Line.MightBeFunctionDecl && Contexts.size() == 1) { // Line.MightBeFunctionDecl can only be true after the parentheses of a // function declaration have been found. Current.Type = TT_TrailingAnnotation; @@ -1774,7 +1767,6 @@ private: AnnotatedLine &Line; FormatToken *CurrentToken; bool AutoFound; - bool TrailingReturnFound; const AdditionalKeywords &Keywords; // Set of "<" tokens that do not open a template parameter list. If parseAngle |