diff options
author | Daniel Jasper <djasper@google.com> | 2013-08-12 12:16:34 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-08-12 12:16:34 +0000 |
commit | 5903685a285f4993cf14d88751e285bbd8a1f562 (patch) | |
tree | 2d94662dac36043240f0345b46ef394892108d4f /clang/lib/Format/TokenAnnotator.cpp | |
parent | 15dc0af78b5464b89bdf00de1c462adb526f0bb0 (diff) | |
download | bcm5719-llvm-5903685a285f4993cf14d88751e285bbd8a1f562.tar.gz bcm5719-llvm-5903685a285f4993cf14d88751e285bbd8a1f562.zip |
clang-format: Correctly format alias declarations.
Before:
template <class CallbackClass>
using MyCallback = void(CallbackClass::*)(SomeObject * Data);");
After:
template <class CallbackClass>
using MyCallback = void (CallbackClass::*)(SomeObject *Data);");
Also fix three wrong indentations.
llvm-svn: 188172
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 1a9012fa88d..56a1dbac76d 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -123,6 +123,10 @@ private: } } + if (CurrentToken->Previous->Type == TT_PointerOrReference && + CurrentToken->Previous->Previous->isOneOf(tok::l_paren, + tok::coloncolon)) + MightBeFunctionType = true; if (CurrentToken->is(tok::r_paren)) { if (MightBeFunctionType && CurrentToken->Next && (CurrentToken->Next->is(tok::l_paren) || @@ -152,10 +156,6 @@ private: } if (CurrentToken->isOneOf(tok::r_square, tok::r_brace)) return false; - if (CurrentToken->Previous->Type == TT_PointerOrReference && - CurrentToken->Previous->Previous->isOneOf(tok::l_paren, - tok::coloncolon)) - MightBeFunctionType = true; updateParameterCount(Left, CurrentToken); if (CurrentToken->is(tok::comma) && CurrentToken->Next && !CurrentToken->Next->HasUnescapedNewline && @@ -577,6 +577,7 @@ private: void determineTokenType(FormatToken &Current) { if (Current.getPrecedence() == prec::Assignment && + !Line.First->isOneOf(tok::kw_template, tok::kw_using) && (!Current.Previous || Current.Previous->isNot(tok::kw_operator))) { Contexts.back().IsExpression = true; for (FormatToken *Previous = Current.Previous; @@ -593,7 +594,7 @@ private: (Current.is(tok::l_paren) && !Line.MustBeDeclaration && !Line.InPPDirective && (!Current.Previous || - !Current.Previous->isOneOf(tok::kw_for, tok::kw_catch)))) { + !Current.Previous->isOneOf(tok::kw_for, tok::kw_catch)))) { Contexts.back().IsExpression = true; } else if (Current.isOneOf(tok::r_paren, tok::greater, tok::comma)) { for (FormatToken *Previous = Current.Previous; |