TokenAnnotator.h revision c2e6d2a4a7fe9dfa7d52a38c6048b7b18e6b591a
132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper//===--- TokenAnnotator.h - Format C++ code ---------------------*- C++ -*-===//
232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper//
332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper//                     The LLVM Compiler Infrastructure
432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper//
532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper// This file is distributed under the University of Illinois Open Source
632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper// License. See LICENSE.TXT for details.
732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper//
832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper//===----------------------------------------------------------------------===//
932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper///
1032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper/// \file
1132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper/// \brief This file implements a token annotator, i.e. creates
1232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper/// \c AnnotatedTokens out of \c FormatTokens with required extra information.
1332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper///
1432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper//===----------------------------------------------------------------------===//
1532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
1632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper#ifndef LLVM_CLANG_FORMAT_TOKEN_ANNOTATOR_H
1732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper#define LLVM_CLANG_FORMAT_TOKEN_ANNOTATOR_H
1832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
1932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper#include "UnwrappedLineParser.h"
2032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper#include "clang/Basic/OperatorPrecedence.h"
2132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper#include "clang/Format/Format.h"
2232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper#include <string>
2332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
2432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jaspernamespace clang {
2532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasperclass Lexer;
2632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasperclass SourceManager;
2732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
2832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jaspernamespace format {
2932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
3032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasperenum TokenType {
3132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_BinaryOperator,
3232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_BlockComment,
3332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_CastRParen,
3432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_ConditionalExpr,
3532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_CtorInitializerColon,
3632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_ImplicitStringLiteral,
3732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_LineComment,
38051860ee770bf83c3e66ab893be3642bb8bc2680Nico Weber  TT_ObjCArrayLiteral,
3932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_ObjCBlockLParen,
4032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_ObjCDecl,
41c2e6d2a4a7fe9dfa7d52a38c6048b7b18e6b591aNico Weber  TT_ObjCForIn,
4232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_ObjCMethodExpr,
43051860ee770bf83c3e66ab893be3642bb8bc2680Nico Weber  TT_ObjCMethodSpecifier,
4432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_ObjCProperty,
4563d7cedca8616921c1908c88c2f23fcd67bbab99Daniel Jasper  TT_ObjCSelectorName,
462b4c924f85e156d66c01b3f16c850892c47dcc7aDaniel Jasper  TT_OverloadedOperatorLParen,
4732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_PointerOrReference,
4832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_PureVirtualSpecifier,
4932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_RangeBasedForLoopColon,
5032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_StartOfName,
5132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_TemplateCloser,
5232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_TemplateOpener,
5332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_TrailingUnaryOperator,
5432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_UnaryOperator,
5532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TT_Unknown
5632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper};
5732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
5832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasperenum LineType {
5932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  LT_Invalid,
6032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  LT_Other,
6132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  LT_BuilderTypeCall,
6232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  LT_PreprocessorDirective,
6332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  LT_VirtualFunctionDecl,
6432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  LT_ObjCDecl, // An @interface, @implementation, or @protocol line.
6532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  LT_ObjCMethodDecl,
6632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  LT_ObjCProperty // An @property line.
6732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper};
6832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
6932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasperclass AnnotatedToken {
7032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasperpublic:
7132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  explicit AnnotatedToken(const FormatToken &FormatTok)
72729a743b317d877df3978e88a4a247d2edbf2090Daniel Jasper      : FormatTok(FormatTok), Type(TT_Unknown), SpacesRequiredBefore(0),
7332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper        CanBreakBefore(false), MustBreakBefore(false),
7432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper        ClosesTemplateDeclaration(false), MatchingParen(NULL),
7563d7cedca8616921c1908c88c2f23fcd67bbab99Daniel Jasper        ParameterCount(1), BindingStrength(0), SplitPenalty(0),
7629f123b2fa0435bb1962f0d9e9a2e660f35fbb2fDaniel Jasper        LongestObjCSelectorName(0), Parent(NULL), FakeLParens(0),
7729f123b2fa0435bb1962f0d9e9a2e660f35fbb2fDaniel Jasper        FakeRParens(0) {
7832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  }
7932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
8032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  bool is(tok::TokenKind Kind) const { return FormatTok.Tok.is(Kind); }
8132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  bool isNot(tok::TokenKind Kind) const { return FormatTok.Tok.isNot(Kind); }
8232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
8332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  bool isObjCAtKeyword(tok::ObjCKeywordKind Kind) const {
8432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper    return FormatTok.Tok.isObjCAtKeyword(Kind);
8532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  }
8632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
8732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  FormatToken FormatTok;
8832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
8932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  TokenType Type;
9032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
91729a743b317d877df3978e88a4a247d2edbf2090Daniel Jasper  unsigned SpacesRequiredBefore;
9232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  bool CanBreakBefore;
9332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  bool MustBreakBefore;
9432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
9532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  bool ClosesTemplateDeclaration;
9632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
9732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  AnnotatedToken *MatchingParen;
9832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
9932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  /// \brief Number of parameters, if this is "(", "[" or "<".
10032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  ///
10132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  /// This is initialized to 1 as we don't need to distinguish functions with
10232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  /// 0 parameters from functions with 1 parameter. Thus, we can simply count
10332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  /// the number of commas.
10432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  unsigned ParameterCount;
10532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
10632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  /// \brief The total length of the line up to and including this token.
10732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  unsigned TotalLength;
10832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
1090178673f541685cf5067814dfeee2644078e39a9Daniel Jasper  // FIXME: Come up with a 'cleaner' concept.
1100178673f541685cf5067814dfeee2644078e39a9Daniel Jasper  /// \brief The binding strength of a token. This is a combined value of
1110178673f541685cf5067814dfeee2644078e39a9Daniel Jasper  /// operator precedence, parenthesis nesting, etc.
1120178673f541685cf5067814dfeee2644078e39a9Daniel Jasper  unsigned BindingStrength;
1130178673f541685cf5067814dfeee2644078e39a9Daniel Jasper
11432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  /// \brief Penalty for inserting a line break before this token.
11532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  unsigned SplitPenalty;
11632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
11763d7cedca8616921c1908c88c2f23fcd67bbab99Daniel Jasper  /// \brief If this is the first ObjC selector name in an ObjC method
11863d7cedca8616921c1908c88c2f23fcd67bbab99Daniel Jasper  /// definition or call, this contains the length of the longest name.
11963d7cedca8616921c1908c88c2f23fcd67bbab99Daniel Jasper  unsigned LongestObjCSelectorName;
12063d7cedca8616921c1908c88c2f23fcd67bbab99Daniel Jasper
12132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  std::vector<AnnotatedToken> Children;
12232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  AnnotatedToken *Parent;
12332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
12429f123b2fa0435bb1962f0d9e9a2e660f35fbb2fDaniel Jasper  /// \brief Insert this many fake ( before this token for correct indentation.
12529f123b2fa0435bb1962f0d9e9a2e660f35fbb2fDaniel Jasper  unsigned FakeLParens;
126087387a1e9ce5abeb4f348e14f64e5c2273eaedbDaniel Jasper  /// \brief Insert this many fake ) after this token for correct indentation.
12729f123b2fa0435bb1962f0d9e9a2e660f35fbb2fDaniel Jasper  unsigned FakeRParens;
12829f123b2fa0435bb1962f0d9e9a2e660f35fbb2fDaniel Jasper
12932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  const AnnotatedToken *getPreviousNoneComment() const {
13032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper    AnnotatedToken *Tok = Parent;
13132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper    while (Tok != NULL && Tok->is(tok::comment))
13232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper      Tok = Tok->Parent;
13332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper    return Tok;
13432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  }
13532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper};
13632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
13732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasperclass AnnotatedLine {
13832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasperpublic:
13932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  AnnotatedLine(const UnwrappedLine &Line)
14032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper      : First(Line.Tokens.front()), Level(Line.Level),
14132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper        InPPDirective(Line.InPPDirective),
14232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper        MustBeDeclaration(Line.MustBeDeclaration) {
14332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper    assert(!Line.Tokens.empty());
14432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper    AnnotatedToken *Current = &First;
14532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper    for (std::list<FormatToken>::const_iterator I = ++Line.Tokens.begin(),
14632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper                                                E = Line.Tokens.end();
14732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper         I != E; ++I) {
14832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper      Current->Children.push_back(AnnotatedToken(*I));
14932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper      Current->Children[0].Parent = Current;
15032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper      Current = &Current->Children[0];
15132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper    }
15232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper    Last = Current;
15332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  }
15432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  AnnotatedLine(const AnnotatedLine &Other)
15532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper      : First(Other.First), Type(Other.Type), Level(Other.Level),
15632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper        InPPDirective(Other.InPPDirective),
15732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper        MustBeDeclaration(Other.MustBeDeclaration) {
15832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper    Last = &First;
15932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper    while (!Last->Children.empty()) {
16032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper      Last->Children[0].Parent = Last;
16132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper      Last = &Last->Children[0];
16232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper    }
16332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  }
16432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
16532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  AnnotatedToken First;
16632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  AnnotatedToken *Last;
16732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
16832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  LineType Type;
16932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  unsigned Level;
17032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  bool InPPDirective;
17132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  bool MustBeDeclaration;
17232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper};
17332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
17432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasperinline prec::Level getPrecedence(const AnnotatedToken &Tok) {
17532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  return getBinOpPrecedence(Tok.FormatTok.Tok.getKind(), true, true);
17632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper}
17732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
17832d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper/// \brief Determines extra information about the tokens comprising an
17932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper/// \c UnwrappedLine.
18032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasperclass TokenAnnotator {
18132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasperpublic:
182c2e6d2a4a7fe9dfa7d52a38c6048b7b18e6b591aNico Weber  TokenAnnotator(const FormatStyle &Style, SourceManager &SourceMgr, Lexer &Lex,
183c2e6d2a4a7fe9dfa7d52a38c6048b7b18e6b591aNico Weber                 IdentifierInfo &Ident_in)
184c2e6d2a4a7fe9dfa7d52a38c6048b7b18e6b591aNico Weber      : Style(Style), SourceMgr(SourceMgr), Lex(Lex), Ident_in(Ident_in) {
18532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  }
18632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
1878ff690ab478b33e0d830a6203de12d191d94f8ffDaniel Jasper  void annotate(AnnotatedLine &Line);
1888ff690ab478b33e0d830a6203de12d191d94f8ffDaniel Jasper  void calculateFormattingInformation(AnnotatedLine &Line);
18932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
19032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasperprivate:
19132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  /// \brief Calculate the penalty for splitting before \c Tok.
1928ff690ab478b33e0d830a6203de12d191d94f8ffDaniel Jasper  unsigned splitPenalty(const AnnotatedLine &Line, const AnnotatedToken &Tok);
19332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
1948ff690ab478b33e0d830a6203de12d191d94f8ffDaniel Jasper  bool spaceRequiredBetween(const AnnotatedLine &Line,
1958ff690ab478b33e0d830a6203de12d191d94f8ffDaniel Jasper                            const AnnotatedToken &Left,
19632d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper                            const AnnotatedToken &Right);
19732d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
1988ff690ab478b33e0d830a6203de12d191d94f8ffDaniel Jasper  bool spaceRequiredBefore(const AnnotatedLine &Line,
1998ff690ab478b33e0d830a6203de12d191d94f8ffDaniel Jasper                           const AnnotatedToken &Tok);
20032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
2018ff690ab478b33e0d830a6203de12d191d94f8ffDaniel Jasper  bool canBreakBefore(const AnnotatedLine &Line, const AnnotatedToken &Right);
20232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
2038ff690ab478b33e0d830a6203de12d191d94f8ffDaniel Jasper  const FormatStyle &Style;
20432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  SourceManager &SourceMgr;
20532d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper  Lexer &Lex;
206c2e6d2a4a7fe9dfa7d52a38c6048b7b18e6b591aNico Weber
207c2e6d2a4a7fe9dfa7d52a38c6048b7b18e6b591aNico Weber  // Contextual keywords:
208c2e6d2a4a7fe9dfa7d52a38c6048b7b18e6b591aNico Weber  IdentifierInfo &Ident_in;
20932d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper};
21032d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
21132d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper} // end namespace format
21232d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper} // end namespace clang
21332d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper
21432d28ee6061930b2a9c170cbaaeea028c88a7b89Daniel Jasper#endif // LLVM_CLANG_FORMAT_TOKEN_ANNOTATOR_H
215