]> granicus.if.org Git - clang/commitdiff
clang-format: FIXME that led to access of uninitialized memory.
authorDaniel Jasper <djasper@google.com>
Thu, 29 Jan 2015 13:11:47 +0000 (13:11 +0000)
committerDaniel Jasper <djasper@google.com>
Thu, 29 Jan 2015 13:11:47 +0000 (13:11 +0000)
I have so far not succeeded in finding a nicely reduced test case or an
observable difference which could help me create a test failure without
msan.

Committing without test to unblock kcc's further fuzzing progress.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227433 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/Format.cpp

index 2a4721f2b3b7dbda84e6a00b46e3ceefa653bace..128a5a78889df0837169f3427791228da455c873 100644 (file)
@@ -845,8 +845,8 @@ private:
   FormatToken *getNextToken() {
     if (GreaterStashed) {
       // Create a synthesized second '>' token.
-      // FIXME: Increment Column and set OriginalColumn.
       Token Greater = FormatTok->Tok;
+      unsigned OriginalColumn = FormatTok->OriginalColumn;
       FormatTok = new (Allocator.Allocate()) FormatToken;
       FormatTok->Tok = Greater;
       SourceLocation GreaterLocation =
@@ -855,6 +855,7 @@ private:
           SourceRange(GreaterLocation, GreaterLocation);
       FormatTok->TokenText = ">";
       FormatTok->ColumnWidth = 1;
+      FormatTok->OriginalColumn = OriginalColumn;
       GreaterStashed = false;
       return FormatTok;
     }