Change the data structure used in clang-format.

This is a first step towards supporting more complex structures such
as #ifs inside unwrapped lines. This patch mostly converts the array-based
UnwrappedLine into a linked-list-based UnwrappedLine. Future changes will
allow multiple children for each Token turning the UnwrappedLine into a
tree.

No functional changes intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171856 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/UnwrappedLineParser.h b/lib/Format/UnwrappedLineParser.h
index a9f0475..010bad8 100644
--- a/lib/Format/UnwrappedLineParser.h
+++ b/lib/Format/UnwrappedLineParser.h
@@ -24,6 +24,8 @@
 #include "clang/Format/Format.h"
 #include "clang/Lex/Lexer.h"
 
+#include <vector>
+
 namespace clang {
 namespace format {
 
@@ -65,6 +67,11 @@
 
   /// \brief Indicates that this is the first token.
   bool IsFirst;
+
+  // FIXME: We currently assume that there is exactly one token in this vector
+  // except for the very last token that does not have any children.
+  /// \brief All tokens that logically follow this token.
+  std::vector<FormatToken> Children;
 };
 
 /// \brief An unwrapped line is a sequence of \c Token, that we would like to
@@ -78,7 +85,7 @@
   }
 
   /// \brief The \c Token comprising this \c UnwrappedLine.
-  SmallVector<FormatToken, 16> Tokens;
+  FormatToken RootToken;
 
   /// \brief The indent level of the \c UnwrappedLine.
   unsigned Level;
@@ -138,6 +145,8 @@
   // subtracted from beyond 0. Introduce a method to subtract from Line.Level
   // and use that everywhere in the Parser.
   UnwrappedLine Line;
+  bool RootTokenInitialized;
+  FormatToken *LastInCurrentLine;
   FormatToken FormatTok;
 
   const FormatStyle &Style;