Correctly format macro with unfinished template declaration.
We can now format:
#define A template <typename T>
Before this created a segfault :-/.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175533 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index bb2e04b..d9368c3 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -293,7 +293,8 @@
next();
if (!parseAngle())
return false;
- CurrentToken->Parent->ClosesTemplateDeclaration = true;
+ if (CurrentToken != NULL)
+ CurrentToken->Parent->ClosesTemplateDeclaration = true;
return true;
}
return false;