[PATCH] D146354: [clang][ExtractAPI] Add semicolons for enum, typedef, struct declaration fragments

NagaChaitanya Vellanki via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 18 11:09:12 PDT 2023


chaitanyav updated this revision to Diff 506308.
chaitanyav added a comment.

- Update reference output in underscored.c
- combine return and append semicolon fragment


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146354/new/

https://reviews.llvm.org/D146354

Files:
  clang/lib/ExtractAPI/DeclarationFragments.cpp
  clang/test/ExtractAPI/underscored.c


Index: clang/test/ExtractAPI/underscored.c
===================================================================
--- clang/test/ExtractAPI/underscored.c
+++ clang/test/ExtractAPI/underscored.c
@@ -135,6 +135,10 @@
         {
           "kind": "identifier",
           "spelling": "ExposedRecord"
+        },
+        {
+          "kind": "text",
+          "spelling": ";"
         }
       ],
       "identifier": {
@@ -296,6 +300,10 @@
         {
           "kind": "identifier",
           "spelling": "ExposedTypedef"
+        },
+        {
+          "kind": "text",
+          "spelling": ";"
         }
       ],
       "identifier": {
@@ -356,6 +364,10 @@
         {
           "kind": "identifier",
           "spelling": "ExposedTypedefToHidden"
+        },
+        {
+          "kind": "text",
+          "spelling": ";"
         }
       ],
       "identifier": {
Index: clang/lib/ExtractAPI/DeclarationFragments.cpp
===================================================================
--- clang/lib/ExtractAPI/DeclarationFragments.cpp
+++ clang/lib/ExtractAPI/DeclarationFragments.cpp
@@ -470,8 +470,7 @@
             getFragmentsForType(IntegerType, EnumDecl->getASTContext(), After))
         .append(std::move(After));
 
-  Fragments.append(";", DeclarationFragments::FragmentKind::Text);
-  return Fragments;
+  return Fragments.append(";", DeclarationFragments::FragmentKind::Text);
 }
 
 DeclarationFragments
@@ -495,8 +494,7 @@
     Fragments.appendSpace().append(
         Record->getName(), DeclarationFragments::FragmentKind::Identifier);
 
-  Fragments.append(";", DeclarationFragments::FragmentKind::Text);
-  return Fragments;
+  return Fragments.append(";", DeclarationFragments::FragmentKind::Text);
 }
 
 DeclarationFragments
@@ -746,8 +744,7 @@
       .appendSpace()
       .append(Decl->getName(), DeclarationFragments::FragmentKind::Identifier);
 
-  Fragments.append(";", DeclarationFragments::FragmentKind::Text);
-  return Fragments;
+  return Fragments.append(";", DeclarationFragments::FragmentKind::Text);
 }
 
 template <typename FunctionT>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146354.506308.patch
Type: text/x-patch
Size: 2079 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230318/955db715/attachment-0001.bin>


More information about the cfe-commits mailing list