[PATCH] D73977: [clang-format] Allow a comment to follow a C# attribute specifier

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 11:08:18 PST 2020


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 <jbcoe at 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;
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73977.242382.patch
Type: text/x-patch
Size: 1218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200204/837d7d6e/attachment.bin>


More information about the cfe-commits mailing list