Add missing clang-format null pointer check..
.. and a test that triggers it in valid albeit questionable code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175554 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index d9368c3..ac7301e 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -592,7 +592,8 @@
else
Current.Type = TT_BlockComment;
} else if (Current.is(tok::r_paren)) {
- bool ParensNotExpr = Current.Parent->Type == TT_PointerOrReference ||
+ bool ParensNotExpr = !Current.Parent ||
+ Current.Parent->Type == TT_PointerOrReference ||
Current.Parent->Type == TT_TemplateCloser;
bool ParensCouldEndDecl =
!Current.Children.empty() && (Current.Children[0].is(tok::equal) ||