Don't format sizeof/alignof as function types.
Before: A<sizeof (*x)> a;
After: A<sizeof(*x)> a;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181764 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 29eaaa8..0f91b11 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -173,7 +173,9 @@
}
if (CurrentToken->isOneOf(tok::r_square, tok::r_brace))
return false;
- if (CurrentToken->Parent->Type == TT_PointerOrReference &&
+ if (Left->Parent &&
+ !Left->Parent->isOneOf(tok::kw_sizeof, tok::kw_alignof) &&
+ CurrentToken->Parent->Type == TT_PointerOrReference &&
CurrentToken->Parent->Parent->isOneOf(tok::l_paren, tok::coloncolon))
Left->DefinesFunctionType = true;
updateParameterCount(Left, CurrentToken);