aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/UnwrappedLineParser.cpp
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-01-23 14:08:21 +0000
committerManuel Klimek <klimek@google.com>2013-01-23 14:08:21 +0000
commita32a7fda316289dca6aac1352fde3caf14a1cb2f (patch)
treedab48dbe824f0b6323ec80ef704572cf0c324a36 /lib/Format/UnwrappedLineParser.cpp
parent20d3583857c2cc99dcc9c27ff5f23916df9c0812 (diff)
Fixes layouting regression and invalid-read.
Layouting would prevent breaking before + in a[b + c] = d; Regression detected by code review. Also fixes an invalid-read found by the valgrind bot. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173262 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--lib/Format/UnwrappedLineParser.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp
index c21fa0d74e..1b39442610 100644
--- a/lib/Format/UnwrappedLineParser.cpp
+++ b/lib/Format/UnwrappedLineParser.cpp
@@ -38,7 +38,10 @@ public:
}
~ScopedDeclarationState() {
Stack.pop_back();
- Line.MustBeDeclaration = Stack.back();
+ if (!Stack.empty())
+ Line.MustBeDeclaration = Stack.back();
+ else
+ Line.MustBeDeclaration = true;
}
private:
UnwrappedLine &Line;