diff options
author | Daniel Jasper <djasper@google.com> | 2013-04-10 09:49:49 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-04-10 09:49:49 +0000 |
commit | ac3223e45e7d17c65b143439313800eef4fdf71d (patch) | |
tree | 83f9a57f7d88d5305cf647096b6063780464e66e /lib/Format/TokenAnnotator.h | |
parent | 02be968a08184acd42aaefa6f9a7dc883a4d1937 (diff) | |
download | clang-ac3223e45e7d17c65b143439313800eef4fdf71d.tar.gz |
Fix labels with trailing comments and cleanup.
Before:
class A {
public : // test
};
After:
class A {
public: // test
};
Also remove duplicate methods calculating properties of AnnotatedTokens
and make them members of AnnotatedTokens so that they are in a common
place.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179167 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/TokenAnnotator.h')
-rw-r--r-- | lib/Format/TokenAnnotator.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/Format/TokenAnnotator.h b/lib/Format/TokenAnnotator.h index f5a8a9430c..0dde1fa903 100644 --- a/lib/Format/TokenAnnotator.h +++ b/lib/Format/TokenAnnotator.h @@ -121,6 +121,15 @@ public: Children[0].isObjCAtKeyword(tok::objc_private)); } + /// \brief Returns whether \p Tok is ([{ or a template opening <. + bool opensScope() const; + /// \brief Returns whether \p Tok is )]} or a template opening >. + bool closesScope() const; + + bool isUnaryOperator() const; + bool isBinaryOperator() const; + bool isTrailingComment() const; + FormatToken FormatTok; TokenType Type; @@ -175,12 +184,11 @@ public: /// Only set if \c Type == \c TT_StartOfName. bool PartOfMultiVariableDeclStmt; - const AnnotatedToken *getPreviousNoneComment() const { - AnnotatedToken *Tok = Parent; - while (Tok != NULL && Tok->is(tok::comment)) - Tok = Tok->Parent; - return Tok; - } + /// \brief Returns the previous token ignoring comments. + AnnotatedToken *getPreviousNoneComment() const; + + /// \brief Returns the next token ignoring comments. + const AnnotatedToken *getNextNoneComment() const; }; class AnnotatedLine { @@ -227,11 +235,6 @@ inline prec::Level getPrecedence(const AnnotatedToken &Tok) { return getBinOpPrecedence(Tok.FormatTok.Tok.getKind(), true, true); } -/// \brief Returns whether \p Tok is ([{ or a template opening <. -bool opensScope(const AnnotatedToken &Tok); -/// \brief Returns whether \p Tok is )]} or a template opening >. -bool closesScope(const AnnotatedToken &Tok); - /// \brief Determines extra information about the tokens comprising an /// \c UnwrappedLine. class TokenAnnotator { |