diff options
| author | Daniel Jasper <djasper@google.com> | 2015-02-17 09:58:03 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2015-02-17 09:58:03 +0000 |
| commit | d97d5d5cf75133ac8872a49f7615e357ab1e13da (patch) | |
| tree | 8c8c1ba752ab37583ebcc613ea6b08c8b09a5435 /clang | |
| parent | fa27b8861b8ae1b9c686d8a50a6eeac72b874afb (diff) | |
| download | bcm5719-llvm-d97d5d5cf75133ac8872a49f7615e357ab1e13da.tar.gz bcm5719-llvm-d97d5d5cf75133ac8872a49f7615e357ab1e13da.zip | |
clang-format: Fix crasher.
llvm-svn: 229485
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 2 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index fa7c7f1d5d8..a02cb680728 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -365,7 +365,7 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, const FormatToken *Next = Previous.MatchingParen->getNextNonComment(); HasTrailingCall = Next && Next->isMemberAccess(); } - if (HasTrailingCall && + if (HasTrailingCall && State.Stack.size() > 1 && State.Stack[State.Stack.size() - 2].CallContinuation == 0) State.Stack.back().LastSpace = State.Column; } diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 242d2ba15e8..52761f163ac 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -5818,6 +5818,7 @@ TEST_F(FormatTest, IncorrectAccessSpecifier) { TEST_F(FormatTest, IncorrectCodeUnbalancedBraces) { verifyFormat("{"); verifyFormat("#})"); + verifyNoCrash("(/**/[:!] ?[)."); } TEST_F(FormatTest, IncorrectCodeDoNoWhile) { |

