aboutsummaryrefslogtreecommitdiff
path: root/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-03-20 15:12:38 +0000
committerDaniel Jasper <djasper@google.com>2013-03-20 15:12:38 +0000
commit6fe554eb4e7075cbfda927c4747d7346a27637f1 (patch)
treef983d0f725a89d9f03d05f6881b6e6faca4dfb3c /lib/Format
parent83a90e5e6525acdb8cc4778ed102cd3952559f15 (diff)
Fix infinite-loop in unwrapped line parser.
Discovered when accidentally formatting a python file :-). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177527 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format')
-rw-r--r--lib/Format/UnwrappedLineParser.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp
index 2ca44620c3..a01344c03e 100644
--- a/lib/Format/UnwrappedLineParser.cpp
+++ b/lib/Format/UnwrappedLineParser.cpp
@@ -684,7 +684,7 @@ void UnwrappedLineParser::parseRecord() {
// (this would still leave us with an ambiguity between template function
// and class declarations).
if (FormatTok.Tok.is(tok::colon) || FormatTok.Tok.is(tok::less)) {
- while (FormatTok.Tok.isNot(tok::l_brace)) {
+ while (!eof() && FormatTok.Tok.isNot(tok::l_brace)) {
if (FormatTok.Tok.is(tok::semi))
return;
nextToken();