Author: Usman Akinyemi Date: 2023-04-04T10:00:34-07:00 New Revision: 32b53cf9d0c8c0e01ce5b0e7d5c717202a98cdf5
URL: https://github.com/llvm/llvm-project/commit/32b53cf9d0c8c0e01ce5b0e7d5c717202a98cdf5 DIFF: https://github.com/llvm/llvm-project/commit/32b53cf9d0c8c0e01ce5b0e7d5c717202a98cdf5.diff LOG: [ExtractAPI] Remove extra attributes in property declaration fragments Use `getPropertyAttributesAsWritten` instead of `getPropertyAttributes` to get property attributes actually specified in the source code. Resolves issue #61478. https://reviews.llvm.org/D146759 Reviewed By: zixuw, dang Differential Revision: https://reviews.llvm.org/D146759 Added: Modified: clang/lib/ExtractAPI/DeclarationFragments.cpp clang/test/ExtractAPI/objc_category.m clang/test/ExtractAPI/objc_id_protocol.m clang/test/ExtractAPI/objc_interface.m clang/test/ExtractAPI/objc_property.m Removed: ################################################################################ diff --git a/clang/lib/ExtractAPI/DeclarationFragments.cpp b/clang/lib/ExtractAPI/DeclarationFragments.cpp index 912e58a0c6e82..da75a701b405e 100644 --- a/clang/lib/ExtractAPI/DeclarationFragments.cpp +++ b/clang/lib/ExtractAPI/DeclarationFragments.cpp @@ -638,7 +638,7 @@ DeclarationFragments DeclarationFragmentsBuilder::getFragmentsForObjCProperty( // Build the Objective-C property keyword. Fragments.append("@property", DeclarationFragments::FragmentKind::Keyword); - const auto Attributes = Property->getPropertyAttributes(); + const auto Attributes = Property->getPropertyAttributesAsWritten(); // Build the attributes if there is any associated with the property. if (Attributes != ObjCPropertyAttribute::kind_noattr) { // No leading comma for the first attribute. diff --git a/clang/test/ExtractAPI/objc_category.m b/clang/test/ExtractAPI/objc_category.m index 185016dfe848c..3323d75f40392 100644 --- a/clang/test/ExtractAPI/objc_category.m +++ b/clang/test/ExtractAPI/objc_category.m @@ -282,39 +282,7 @@ + (void)ClassMethod; }, { "kind": "text", - "spelling": " (" - }, - { - "kind": "keyword", - "spelling": "atomic" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "assign" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "unsafe_unretained" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "readwrite" - }, - { - "kind": "text", - "spelling": ") " + "spelling": " " }, { "kind": "typeIdentifier", diff --git a/clang/test/ExtractAPI/objc_id_protocol.m b/clang/test/ExtractAPI/objc_id_protocol.m index 551e908ae4fdd..02f4cde772d48 100644 --- a/clang/test/ExtractAPI/objc_id_protocol.m +++ b/clang/test/ExtractAPI/objc_id_protocol.m @@ -122,14 +122,6 @@ @interface MyInterface "kind": "text", "spelling": " (" }, - { - "kind": "keyword", - "spelling": "atomic" - }, - { - "kind": "text", - "spelling": ", " - }, { "kind": "keyword", "spelling": "copy" @@ -206,30 +198,6 @@ @interface MyInterface "kind": "text", "spelling": " (" }, - { - "kind": "keyword", - "spelling": "atomic" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "assign" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "unsafe_unretained" - }, - { - "kind": "text", - "spelling": ", " - }, { "kind": "keyword", "spelling": "readwrite" diff --git a/clang/test/ExtractAPI/objc_interface.m b/clang/test/ExtractAPI/objc_interface.m index 159e97a193a13..3f53546866513 100644 --- a/clang/test/ExtractAPI/objc_interface.m +++ b/clang/test/ExtractAPI/objc_interface.m @@ -432,14 +432,6 @@ - (char)getIvar; "kind": "text", "spelling": " (" }, - { - "kind": "keyword", - "spelling": "atomic" - }, - { - "kind": "text", - "spelling": ", " - }, { "kind": "keyword", "spelling": "readonly" diff --git a/clang/test/ExtractAPI/objc_property.m b/clang/test/ExtractAPI/objc_property.m index f09a5ad724238..9c69a1156bffd 100644 --- a/clang/test/ExtractAPI/objc_property.m +++ b/clang/test/ExtractAPI/objc_property.m @@ -161,38 +161,6 @@ @interface Interface (Category) <Protocol> "kind": "keyword", "spelling": "class" }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "atomic" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "assign" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "unsafe_unretained" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "readwrite" - }, { "kind": "text", "spelling": ") " @@ -255,39 +223,7 @@ @interface Interface (Category) <Protocol> }, { "kind": "text", - "spelling": " (" - }, - { - "kind": "keyword", - "spelling": "atomic" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "assign" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "unsafe_unretained" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "readwrite" - }, - { - "kind": "text", - "spelling": ") " + "spelling": " " }, { "kind": "typeIdentifier", @@ -353,38 +289,6 @@ @interface Interface (Category) <Protocol> "kind": "keyword", "spelling": "class" }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "atomic" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "assign" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "unsafe_unretained" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "readwrite" - }, { "kind": "text", "spelling": ") " @@ -447,39 +351,7 @@ @interface Interface (Category) <Protocol> }, { "kind": "text", - "spelling": " (" - }, - { - "kind": "keyword", - "spelling": "atomic" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "assign" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "unsafe_unretained" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "readwrite" - }, - { - "kind": "text", - "spelling": ") " + "spelling": " " }, { "kind": "typeIdentifier", @@ -595,38 +467,6 @@ @interface Interface (Category) <Protocol> "kind": "keyword", "spelling": "class" }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "atomic" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "assign" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "unsafe_unretained" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "readwrite" - }, { "kind": "text", "spelling": ") " @@ -689,39 +529,7 @@ @interface Interface (Category) <Protocol> }, { "kind": "text", - "spelling": " (" - }, - { - "kind": "keyword", - "spelling": "atomic" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "assign" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "unsafe_unretained" - }, - { - "kind": "text", - "spelling": ", " - }, - { - "kind": "keyword", - "spelling": "readwrite" - }, - { - "kind": "text", - "spelling": ") " + "spelling": " " }, { "kind": "typeIdentifier", _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits