r182476 - Fix uninitialized access error found by valgrind.

Manuel Klimek klimek at google.com
Wed May 22 07:01:08 PDT 2013


Author: klimek
Date: Wed May 22 09:01:08 2013
New Revision: 182476

URL: http://llvm.org/viewvc/llvm-project?rev=182476&view=rev
Log:
Fix uninitialized access error found by valgrind.

Modified:
    cfe/trunk/lib/Format/WhitespaceManager.cpp

Modified: cfe/trunk/lib/Format/WhitespaceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/WhitespaceManager.cpp?rev=182476&r1=182475&r2=182476&view=diff
==============================================================================
--- cfe/trunk/lib/Format/WhitespaceManager.cpp (original)
+++ cfe/trunk/lib/Format/WhitespaceManager.cpp Wed May 22 09:01:08 2013
@@ -129,6 +129,9 @@ void WhitespaceManager::calculateLineBre
         (Changes[i].NewlinesBefore > 0 || Changes[i].Kind == tok::eof) &&
         Changes[i - 1].Kind == tok::comment;
   }
+  // FIXME: The last token is currently not always an eof token; in those
+  // cases, setting TokenLength of the last token to 0 is wrong.
+  Changes.back().TokenLength = 0;
   Changes.back().IsTrailingComment = Changes.back().Kind == tok::comment;
 }
 





More information about the cfe-commits mailing list