]> granicus.if.org Git - clang/commitdiff
Fix uninitialized value bug found by valgrind.
authorDaniel Jasper <djasper@google.com>
Tue, 14 May 2013 10:44:17 +0000 (10:44 +0000)
committerDaniel Jasper <djasper@google.com>
Tue, 14 May 2013 10:44:17 +0000 (10:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181779 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/TokenAnnotator.cpp
lib/Format/TokenAnnotator.h

index 0f91b110339bd685cbeff6fd4c128a53f280ca79..11f81fd8baf732ba57c46480160c845b6d77628d 100644 (file)
@@ -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) {
index 5ea30159a2a0d3b8b484800776c23055886393fe..227dd523960579901df18b98d4c4200b4fd5b569 100644 (file)
@@ -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); }