Skip to content

Commit 622a043

Browse files
Unique-Usmandaniel-grumberg
authored andcommitted
[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 llvm#61478. https://reviews.llvm.org/D146759 Reviewed By: zixuw, dang Differential Revision: https://reviews.llvm.org/D146759
1 parent ba9a450 commit 622a043

File tree

4 files changed

+5
-237
lines changed

4 files changed

+5
-237
lines changed

clang/lib/ExtractAPI/DeclarationFragments.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ DeclarationFragments DeclarationFragmentsBuilder::getFragmentsForObjCProperty(
622622
// Build the Objective-C property keyword.
623623
Fragments.append("@property", DeclarationFragments::FragmentKind::Keyword);
624624

625-
const auto Attributes = Property->getPropertyAttributes();
625+
const auto Attributes = Property->getPropertyAttributesAsWritten();
626626
// Build the attributes if there is any associated with the property.
627627
if (Attributes != ObjCPropertyAttribute::kind_noattr) {
628628
// No leading comma for the first attribute.

clang/test/ExtractAPI/objc_category.m

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -282,39 +282,7 @@ + (void)ClassMethod;
282282
},
283283
{
284284
"kind": "text",
285-
"spelling": " ("
286-
},
287-
{
288-
"kind": "keyword",
289-
"spelling": "atomic"
290-
},
291-
{
292-
"kind": "text",
293-
"spelling": ", "
294-
},
295-
{
296-
"kind": "keyword",
297-
"spelling": "assign"
298-
},
299-
{
300-
"kind": "text",
301-
"spelling": ", "
302-
},
303-
{
304-
"kind": "keyword",
305-
"spelling": "unsafe_unretained"
306-
},
307-
{
308-
"kind": "text",
309-
"spelling": ", "
310-
},
311-
{
312-
"kind": "keyword",
313-
"spelling": "readwrite"
314-
},
315-
{
316-
"kind": "text",
317-
"spelling": ") "
285+
"spelling": " "
318286
},
319287
{
320288
"kind": "typeIdentifier",

clang/test/ExtractAPI/objc_interface.m

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -432,14 +432,6 @@ - (char)getIvar;
432432
"kind": "text",
433433
"spelling": " ("
434434
},
435-
{
436-
"kind": "keyword",
437-
"spelling": "atomic"
438-
},
439-
{
440-
"kind": "text",
441-
"spelling": ", "
442-
},
443435
{
444436
"kind": "keyword",
445437
"spelling": "readonly"

clang/test/ExtractAPI/objc_property.m

Lines changed: 3 additions & 195 deletions
Original file line numberDiff line numberDiff line change
@@ -161,38 +161,6 @@ @interface Interface (Category) <Protocol>
161161
"kind": "keyword",
162162
"spelling": "class"
163163
},
164-
{
165-
"kind": "text",
166-
"spelling": ", "
167-
},
168-
{
169-
"kind": "keyword",
170-
"spelling": "atomic"
171-
},
172-
{
173-
"kind": "text",
174-
"spelling": ", "
175-
},
176-
{
177-
"kind": "keyword",
178-
"spelling": "assign"
179-
},
180-
{
181-
"kind": "text",
182-
"spelling": ", "
183-
},
184-
{
185-
"kind": "keyword",
186-
"spelling": "unsafe_unretained"
187-
},
188-
{
189-
"kind": "text",
190-
"spelling": ", "
191-
},
192-
{
193-
"kind": "keyword",
194-
"spelling": "readwrite"
195-
},
196164
{
197165
"kind": "text",
198166
"spelling": ") "
@@ -255,39 +223,7 @@ @interface Interface (Category) <Protocol>
255223
},
256224
{
257225
"kind": "text",
258-
"spelling": " ("
259-
},
260-
{
261-
"kind": "keyword",
262-
"spelling": "atomic"
263-
},
264-
{
265-
"kind": "text",
266-
"spelling": ", "
267-
},
268-
{
269-
"kind": "keyword",
270-
"spelling": "assign"
271-
},
272-
{
273-
"kind": "text",
274-
"spelling": ", "
275-
},
276-
{
277-
"kind": "keyword",
278-
"spelling": "unsafe_unretained"
279-
},
280-
{
281-
"kind": "text",
282-
"spelling": ", "
283-
},
284-
{
285-
"kind": "keyword",
286-
"spelling": "readwrite"
287-
},
288-
{
289-
"kind": "text",
290-
"spelling": ") "
226+
"spelling": " "
291227
},
292228
{
293229
"kind": "typeIdentifier",
@@ -353,38 +289,6 @@ @interface Interface (Category) <Protocol>
353289
"kind": "keyword",
354290
"spelling": "class"
355291
},
356-
{
357-
"kind": "text",
358-
"spelling": ", "
359-
},
360-
{
361-
"kind": "keyword",
362-
"spelling": "atomic"
363-
},
364-
{
365-
"kind": "text",
366-
"spelling": ", "
367-
},
368-
{
369-
"kind": "keyword",
370-
"spelling": "assign"
371-
},
372-
{
373-
"kind": "text",
374-
"spelling": ", "
375-
},
376-
{
377-
"kind": "keyword",
378-
"spelling": "unsafe_unretained"
379-
},
380-
{
381-
"kind": "text",
382-
"spelling": ", "
383-
},
384-
{
385-
"kind": "keyword",
386-
"spelling": "readwrite"
387-
},
388292
{
389293
"kind": "text",
390294
"spelling": ") "
@@ -447,39 +351,7 @@ @interface Interface (Category) <Protocol>
447351
},
448352
{
449353
"kind": "text",
450-
"spelling": " ("
451-
},
452-
{
453-
"kind": "keyword",
454-
"spelling": "atomic"
455-
},
456-
{
457-
"kind": "text",
458-
"spelling": ", "
459-
},
460-
{
461-
"kind": "keyword",
462-
"spelling": "assign"
463-
},
464-
{
465-
"kind": "text",
466-
"spelling": ", "
467-
},
468-
{
469-
"kind": "keyword",
470-
"spelling": "unsafe_unretained"
471-
},
472-
{
473-
"kind": "text",
474-
"spelling": ", "
475-
},
476-
{
477-
"kind": "keyword",
478-
"spelling": "readwrite"
479-
},
480-
{
481-
"kind": "text",
482-
"spelling": ") "
354+
"spelling": " "
483355
},
484356
{
485357
"kind": "typeIdentifier",
@@ -595,38 +467,6 @@ @interface Interface (Category) <Protocol>
595467
"kind": "keyword",
596468
"spelling": "class"
597469
},
598-
{
599-
"kind": "text",
600-
"spelling": ", "
601-
},
602-
{
603-
"kind": "keyword",
604-
"spelling": "atomic"
605-
},
606-
{
607-
"kind": "text",
608-
"spelling": ", "
609-
},
610-
{
611-
"kind": "keyword",
612-
"spelling": "assign"
613-
},
614-
{
615-
"kind": "text",
616-
"spelling": ", "
617-
},
618-
{
619-
"kind": "keyword",
620-
"spelling": "unsafe_unretained"
621-
},
622-
{
623-
"kind": "text",
624-
"spelling": ", "
625-
},
626-
{
627-
"kind": "keyword",
628-
"spelling": "readwrite"
629-
},
630470
{
631471
"kind": "text",
632472
"spelling": ") "
@@ -689,39 +529,7 @@ @interface Interface (Category) <Protocol>
689529
},
690530
{
691531
"kind": "text",
692-
"spelling": " ("
693-
},
694-
{
695-
"kind": "keyword",
696-
"spelling": "atomic"
697-
},
698-
{
699-
"kind": "text",
700-
"spelling": ", "
701-
},
702-
{
703-
"kind": "keyword",
704-
"spelling": "assign"
705-
},
706-
{
707-
"kind": "text",
708-
"spelling": ", "
709-
},
710-
{
711-
"kind": "keyword",
712-
"spelling": "unsafe_unretained"
713-
},
714-
{
715-
"kind": "text",
716-
"spelling": ", "
717-
},
718-
{
719-
"kind": "keyword",
720-
"spelling": "readwrite"
721-
},
722-
{
723-
"kind": "text",
724-
"spelling": ") "
532+
"spelling": " "
725533
},
726534
{
727535
"kind": "typeIdentifier",

0 commit comments

Comments
 (0)