Reviewed By: MyDeveloperDay, krasimir
Patch By: jbcoe
Differential Revision: https://reviews.llvm.org/D72150
/// Determine whether ')' is ending a cast.
bool rParenEndsCast(const FormatToken &Tok) {
- // C-style casts are only used in C++ and Java.
- if (!Style.isCpp() && Style.Language != FormatStyle::LK_Java)
+ // C-style casts are only used in C++, C# and Java.
+ if (!Style.isCSharp() && !Style.isCpp() &&
+ Style.Language != FormatStyle::LK_Java)
return false;
// Empty parens aren't casts and there are no casts at the end of the line.
Style);
}
+TEST_F(FormatTestCSharp, CSharpSpaceAfterCStyleCast) {
+ FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp);
+
+ verifyFormat("(int)x / y;", Style);
+
+ Style.SpaceAfterCStyleCast = true;
+ verifyFormat("(int) x / y;", Style);
+}
+
} // namespace format
} // end namespace clang