diff options
author | Daniel Jasper <djasper@google.com> | 2015-01-19 10:52:16 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-01-19 10:52:16 +0000 |
commit | 193cdd381b77647a5a96b52b47b47cae454b29c5 (patch) | |
tree | f92656bb3a215a7265bdf63a2de341a712c2bf8e /clang/lib/Format | |
parent | 20e8c3be3ca1b24ddac51e4cfd67eba1cb551210 (diff) | |
download | bcm5719-llvm-193cdd381b77647a5a96b52b47b47cae454b29c5.tar.gz bcm5719-llvm-193cdd381b77647a5a96b52b47b47cae454b29c5.zip |
clang-format: Fix crasher on incomplete condition compilation.
Previously crashing input:
void f(
#if A
);
#else
#endif
llvm-svn: 226451
Diffstat (limited to 'clang/lib/Format')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 4ba3f919697..58902bfbd69 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1361,7 +1361,7 @@ static bool isFunctionDeclarationName(const FormatToken &Current) { assert(Next->is(tok::l_paren)); if (Next->Next == Next->MatchingParen) return true; - for (const FormatToken *Tok = Next->Next; Tok != Next->MatchingParen; + for (const FormatToken *Tok = Next->Next; Tok && Tok != Next->MatchingParen; Tok = Tok->Next) { if (Tok->is(tok::kw_const) || Tok->isSimpleTypeSpecifier() || Tok->isOneOf(TT_PointerOrReference, TT_StartOfName)) |