[clang] 14805dc - [clang][ExtractAPI] Add semicolon to function declaration fragments

NagaChaitanya Vellanki via cfe-commits cfe-commits at lists.llvm.org
Thu May 4 11:48:28 PDT 2023


Author: NagaChaitanya Vellanki
Date: 2023-05-04T11:46:43-07:00
New Revision: 14805dcb0d8abfd5cd015656313f3f98a22e0a1b

URL: https://github.com/llvm/llvm-project/commit/14805dcb0d8abfd5cd015656313f3f98a22e0a1b
DIFF: https://github.com/llvm/llvm-project/commit/14805dcb0d8abfd5cd015656313f3f98a22e0a1b.diff

LOG: [clang][ExtractAPI] Add semicolon to function declaration fragments

Add missing semicolon at the end of function declarations to fragments

Reviewed By: dang

Differential Revision: https://reviews.llvm.org/D149737

Added: 
    

Modified: 
    clang/lib/ExtractAPI/DeclarationFragments.cpp
    clang/test/ExtractAPI/availability.c
    clang/test/ExtractAPI/global_record.c
    clang/test/ExtractAPI/global_record_multifile.c
    clang/test/ExtractAPI/macro_undefined.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/ExtractAPI/DeclarationFragments.cpp b/clang/lib/ExtractAPI/DeclarationFragments.cpp
index da75a701b405e..1e52f221c7982 100644
--- a/clang/lib/ExtractAPI/DeclarationFragments.cpp
+++ b/clang/lib/ExtractAPI/DeclarationFragments.cpp
@@ -457,7 +457,7 @@ DeclarationFragmentsBuilder::getFragmentsForFunction(const FunctionDecl *Func) {
   Fragments.append(")", DeclarationFragments::FragmentKind::Text);
 
   // FIXME: Handle exception specifiers: throw, noexcept
-  return Fragments;
+  return Fragments.append(";", DeclarationFragments::FragmentKind::Text);
 }
 
 DeclarationFragments DeclarationFragmentsBuilder::getFragmentsForEnumConstant(

diff  --git a/clang/test/ExtractAPI/availability.c b/clang/test/ExtractAPI/availability.c
index 7d071909a092e..0c8cd3629f3fd 100644
--- a/clang/test/ExtractAPI/availability.c
+++ b/clang/test/ExtractAPI/availability.c
@@ -76,7 +76,7 @@ void e(void) __attribute__((availability(tvos, unavailable)));
         },
         {
           "kind": "text",
-          "spelling": "()"
+          "spelling": "();"
         }
       ],
       "functionSignature": {
@@ -150,7 +150,7 @@ void e(void) __attribute__((availability(tvos, unavailable)));
         },
         {
           "kind": "text",
-          "spelling": "()"
+          "spelling": "();"
         }
       ],
       "functionSignature": {
@@ -234,7 +234,7 @@ void e(void) __attribute__((availability(tvos, unavailable)));
         },
         {
           "kind": "text",
-          "spelling": "()"
+          "spelling": "();"
         }
       ],
       "functionSignature": {
@@ -334,7 +334,7 @@ void e(void) __attribute__((availability(tvos, unavailable)));
         },
         {
           "kind": "text",
-          "spelling": "()"
+          "spelling": "();"
         }
       ],
       "functionSignature": {
@@ -416,7 +416,7 @@ void e(void) __attribute__((availability(tvos, unavailable)));
         },
         {
           "kind": "text",
-          "spelling": "()"
+          "spelling": "();"
         }
       ],
       "functionSignature": {

diff  --git a/clang/test/ExtractAPI/global_record.c b/clang/test/ExtractAPI/global_record.c
index 8516ac50be858..7ca89875d66ae 100644
--- a/clang/test/ExtractAPI/global_record.c
+++ b/clang/test/ExtractAPI/global_record.c
@@ -189,7 +189,7 @@ char unavailable __attribute__((unavailable));
         },
         {
           "kind": "text",
-          "spelling": ")"
+          "spelling": ");"
         }
       ],
       "docComment": {

diff  --git a/clang/test/ExtractAPI/global_record_multifile.c b/clang/test/ExtractAPI/global_record_multifile.c
index 0eacb8a94b77f..b1e9f9ed21d42 100644
--- a/clang/test/ExtractAPI/global_record_multifile.c
+++ b/clang/test/ExtractAPI/global_record_multifile.c
@@ -191,7 +191,7 @@ char unavailable __attribute__((unavailable));
         },
         {
           "kind": "text",
-          "spelling": ")"
+          "spelling": ");"
         }
       ],
       "docComment": {

diff  --git a/clang/test/ExtractAPI/macro_undefined.c b/clang/test/ExtractAPI/macro_undefined.c
index c7d3dd6cfea8c..f150c10fb2ed6 100644
--- a/clang/test/ExtractAPI/macro_undefined.c
+++ b/clang/test/ExtractAPI/macro_undefined.c
@@ -67,7 +67,7 @@ FUNC_GEN(bar, const int *, unsigned);
         },
         {
           "kind": "text",
-          "spelling": "()"
+          "spelling": "();"
         }
       ],
       "functionSignature": {
@@ -173,7 +173,7 @@ FUNC_GEN(bar, const int *, unsigned);
         },
         {
           "kind": "text",
-          "spelling": ")"
+          "spelling": ");"
         }
       ],
       "functionSignature": {


        


More information about the cfe-commits mailing list