From 8187c76db553d791817a9576f69fedc5b0c90869 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Tue, 14 May 2013 10:44:17 +0000 Subject: [PATCH] Fix uninitialized value bug found by valgrind. llvm-svn: 181779 --- clang/lib/Format/TokenAnnotator.cpp | 2 -- clang/lib/Format/TokenAnnotator.h | 9 +++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 0f91b110339b..11f81fd8baf7 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -874,8 +874,6 @@ void TokenAnnotator::annotate(AnnotatedLine &Line) { Line.First.SpacesRequiredBefore = 1; Line.First.MustBreakBefore = Line.First.FormatTok.MustBreakBefore; Line.First.CanBreakBefore = Line.First.MustBreakBefore; - - Line.First.TotalLength = Line.First.FormatTok.TokenLength; } void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) { diff --git a/clang/lib/Format/TokenAnnotator.h b/clang/lib/Format/TokenAnnotator.h index 5ea30159a2a0..227dd5239605 100644 --- a/clang/lib/Format/TokenAnnotator.h +++ b/clang/lib/Format/TokenAnnotator.h @@ -75,10 +75,11 @@ public: : FormatTok(FormatTok), Type(TT_Unknown), SpacesRequiredBefore(0), CanBreakBefore(false), MustBreakBefore(false), ClosesTemplateDeclaration(false), MatchingParen(NULL), - ParameterCount(0), BindingStrength(0), SplitPenalty(0), - LongestObjCSelectorName(0), DefinesFunctionType(false), Parent(NULL), - FakeRParens(0), LastInChainOfCalls(false), - PartOfMultiVariableDeclStmt(false), NoMoreTokensOnLevel(false) {} + ParameterCount(0), TotalLength(FormatTok.TokenLength), + BindingStrength(0), SplitPenalty(0), LongestObjCSelectorName(0), + DefinesFunctionType(false), Parent(NULL), FakeRParens(0), + LastInChainOfCalls(false), PartOfMultiVariableDeclStmt(false), + NoMoreTokensOnLevel(false) {} bool is(tok::TokenKind Kind) const { return FormatTok.Tok.is(Kind); }