This revision was automatically updated to reflect the committed changes. Closed by commit rG50d8977c459d: [clang-format] Allow a comment to follow a C# attribute specifier (authored by Jonathan Coe <jb...@google.com>). Herald added a project: clang. Herald added a subscriber: cfe-commits.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D73977/new/ https://reviews.llvm.org/D73977 Files: clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/FormatTestCSharp.cpp Index: clang/unittests/Format/FormatTestCSharp.cpp =================================================================== --- clang/unittests/Format/FormatTestCSharp.cpp +++ clang/unittests/Format/FormatTestCSharp.cpp @@ -228,6 +228,11 @@ " set;\n" " get;\n" "}"); + + verifyFormat( + "[DllImport(\"Hello\", EntryPoint = \"hello_world\")]\n" + "// The const char* returned by hello_world must not be deleted.\n" + "private static extern IntPtr HelloFromCpp();)"); } TEST_F(FormatTestCSharp, CSharpUsing) { Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -392,8 +392,8 @@ // Limit this to being an access modifier that follows. if (AttrTok->isOneOf(tok::kw_public, tok::kw_private, tok::kw_protected, - tok::kw_class, tok::kw_static, tok::l_square, - Keywords.kw_internal)) { + tok::comment, tok::kw_class, tok::kw_static, + tok::l_square, Keywords.kw_internal)) { return true; }
Index: clang/unittests/Format/FormatTestCSharp.cpp =================================================================== --- clang/unittests/Format/FormatTestCSharp.cpp +++ clang/unittests/Format/FormatTestCSharp.cpp @@ -228,6 +228,11 @@ " set;\n" " get;\n" "}"); + + verifyFormat( + "[DllImport(\"Hello\", EntryPoint = \"hello_world\")]\n" + "// The const char* returned by hello_world must not be deleted.\n" + "private static extern IntPtr HelloFromCpp();)"); } TEST_F(FormatTestCSharp, CSharpUsing) { Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -392,8 +392,8 @@ // Limit this to being an access modifier that follows. if (AttrTok->isOneOf(tok::kw_public, tok::kw_private, tok::kw_protected, - tok::kw_class, tok::kw_static, tok::l_square, - Keywords.kw_internal)) { + tok::comment, tok::kw_class, tok::kw_static, + tok::l_square, Keywords.kw_internal)) { return true; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits