Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -2614,6 +2614,9 @@ if ((Left.is(tok::r_paren) && Left.is(TT_AttributeParen)) || (Left.is(tok::r_square) && Left.is(TT_AttributeSquare))) return true; + // using (FileStream fs... + if (Style.isCSharp() && Left.is(tok::kw_using) && Right.is(tok::l_paren)) + return true; return Line.Type == LT_ObjCDecl || Left.is(tok::semi) || (Style.SpaceBeforeParens != FormatStyle::SBPO_Never && (Left.isOneOf(tok::pp_elif, tok::kw_for, tok::kw_while, Index: clang/unittests/Format/FormatTestCSharp.cpp =================================================================== --- clang/unittests/Format/FormatTestCSharp.cpp +++ clang/unittests/Format/FormatTestCSharp.cpp @@ -165,6 +165,10 @@ "public string Host {\n set;\n get;\n}"); } +TEST_F(FormatTestCSharp, CSharpUsing) { + verifyFormat("using (StreamWriter sw = new StreamWriter(filename) { }"); +} + TEST_F(FormatTestCSharp, CSharpRegions) { verifyFormat("#region aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa " "aaaaaaaaaaaaaaa long region");