diff options
Diffstat (limited to 'lib/Format/TokenAnnotator.h')
| -rw-r--r-- | lib/Format/TokenAnnotator.h | 22 | 
1 files changed, 13 insertions, 9 deletions
| diff --git a/lib/Format/TokenAnnotator.h b/lib/Format/TokenAnnotator.h index ff8e32a56afc..a948cdb1c419 100644 --- a/lib/Format/TokenAnnotator.h +++ b/lib/Format/TokenAnnotator.h @@ -42,8 +42,8 @@ public:        : First(Line.Tokens.front().Tok), Level(Line.Level),          InPPDirective(Line.InPPDirective),          MustBeDeclaration(Line.MustBeDeclaration), MightBeFunctionDecl(false), -        Affected(false), LeadingEmptyLinesAffected(false), -        ChildrenAffected(false) { +        IsMultiVariableDeclStmt(false), Affected(false), +        LeadingEmptyLinesAffected(false), ChildrenAffected(false) {      assert(!Line.Tokens.empty());      // Calculate Next and Previous for all tokens. Note that we must overwrite @@ -59,11 +59,8 @@ public:        I->Tok->Previous = Current;        Current = Current->Next;        Current->Children.clear(); -      for (SmallVectorImpl<UnwrappedLine>::const_iterator -               I = Node.Children.begin(), -               E = Node.Children.end(); -           I != E; ++I) { -        Children.push_back(new AnnotatedLine(*I)); +      for (const auto& Child : Node.Children) { +        Children.push_back(new AnnotatedLine(Child));          Current->Children.push_back(Children.back());        }      } @@ -75,6 +72,12 @@ public:      for (unsigned i = 0, e = Children.size(); i != e; ++i) {        delete Children[i];      } +    FormatToken *Current = First; +    while (Current) { +      Current->Children.clear(); +      Current->Role.reset(); +      Current = Current->Next; +    }    }    FormatToken *First; @@ -87,6 +90,7 @@ public:    bool InPPDirective;    bool MustBeDeclaration;    bool MightBeFunctionDecl; +  bool IsMultiVariableDeclStmt;    /// \c True if this line should be formatted, i.e. intersects directly or    /// indirectly with one of the input ranges. @@ -101,8 +105,8 @@ public:  private:    // Disallow copying. -  AnnotatedLine(const AnnotatedLine &) LLVM_DELETED_FUNCTION; -  void operator=(const AnnotatedLine &) LLVM_DELETED_FUNCTION; +  AnnotatedLine(const AnnotatedLine &) = delete; +  void operator=(const AnnotatedLine &) = delete;  };  /// \brief Determines extra information about the tokens comprising an | 
