summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/WhitespaceManager.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-03-03 13:59:49 +0000
committerDaniel Jasper <djasper@google.com>2015-03-03 13:59:49 +0000
commit0391e556507af6a77770a5484783c5a470386283 (patch)
tree568fd7a9cd8963f95ab55dc0267693061abba367 /clang/lib/Format/WhitespaceManager.cpp
parentbd05108e53b26a8c5a68bfc867ca77e135a75c34 (diff)
downloadbcm5719-llvm-0391e556507af6a77770a5484783c5a470386283.tar.gz
bcm5719-llvm-0391e556507af6a77770a5484783c5a470386283.zip
clang-format: Fix access to uninitialized memory.
With incomplete code, we aren't guaranteed to generated changes for every token. In that case, we need to assume that even the very first change can continue a preprocessor directive and initialize values accordingly. llvm-svn: 231066
Diffstat (limited to 'clang/lib/Format/WhitespaceManager.cpp')
-rw-r--r--clang/lib/Format/WhitespaceManager.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index 44e5f690a26..fd5dd5991da 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -232,6 +232,7 @@ void WhitespaceManager::alignEscapedNewlines() {
unsigned MaxEndOfLine =
Style.AlignEscapedNewlinesLeft ? 0 : Style.ColumnLimit;
unsigned StartOfMacro = 0;
+ Changes[0].EscapedNewlineColumn = 0;
for (unsigned i = 1, e = Changes.size(); i < e; ++i) {
Change &C = Changes[i];
if (C.NewlinesBefore > 0) {
OpenPOWER on IntegriCloud