summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.h
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-04-10 09:49:49 +0000
committerDaniel Jasper <djasper@google.com>2013-04-10 09:49:49 +0000
commitc04baae34abb1ecd6e6f26dbc1e443d1df584dfe (patch)
treecafbb654a1e75fe8effeb0fbde91861a612d41e4 /clang/lib/Format/TokenAnnotator.h
parent8b1ed28ef1e53772b6ffb9eebccc8a6d06739899 (diff)
downloadbcm5719-llvm-c04baae34abb1ecd6e6f26dbc1e443d1df584dfe.tar.gz
bcm5719-llvm-c04baae34abb1ecd6e6f26dbc1e443d1df584dfe.zip
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. llvm-svn: 179167
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.h')
-rw-r--r--clang/lib/Format/TokenAnnotator.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/clang/lib/Format/TokenAnnotator.h b/clang/lib/Format/TokenAnnotator.h
index f5a8a9430c2..0dde1fa903b 100644
--- a/clang/lib/Format/TokenAnnotator.h
+++ b/clang/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 {
OpenPOWER on IntegriCloud