]> granicus.if.org Git - clang/commitdiff
Patch to fix doxygen trailing comments for ObjectiveC properties.
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 6 Aug 2013 23:29:00 +0000 (23:29 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 6 Aug 2013 23:29:00 +0000 (23:29 +0000)
// rdar://14258334

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187835 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp
test/Index/comment-misc-tags.m

index 63b1b0ead18e16fc9f95d972809c1d175d5ee47e..1fcb6aa1c820e7a0ee3664cfd5fd6c410c94b176 100644 (file)
@@ -182,7 +182,8 @@ RawComment *ASTContext::getRawCommentForDeclNoCache(const Decl *D) const {
   // First check whether we have a trailing comment.
   if (Comment != RawComments.end() &&
       (*Comment)->isDocumentation() && (*Comment)->isTrailingComment() &&
-      (isa<FieldDecl>(D) || isa<EnumConstantDecl>(D) || isa<VarDecl>(D))) {
+      (isa<FieldDecl>(D) || isa<EnumConstantDecl>(D) || isa<VarDecl>(D) ||
+       isa<ObjCPropertyDecl>(D))) {
     std::pair<FileID, unsigned> CommentBeginDecomp
       = SourceMgr.getDecomposedLoc((*Comment)->getSourceRange().getBegin());
     // Check that Doxygen trailing comment comes after the declaration, starts
index 9eae5489fc06905098fcc81d8506e6b6ea37689d..85553b0e13143814a5ecd7a748b5bdaaf152eb68 100644 (file)
@@ -108,3 +108,27 @@ struct Test {int filler;};
 // CHECK:       (CXComment_BlockCommand CommandName=[par]
 // CHECK-NEXT:     (CXComment_Paragraph
 // CHECK-NEXT:     (CXComment_Text Text=[ And this is the second paragraph.])))
+
+// rdar://14258334
+@class NSString;
+
+@interface MyClass {
+}
+
+/// This is the first property and it always worked.
+@property (nonatomic, copy,   readwrite) NSString *     property1;
+@property (nonatomic, copy,   readwrite) NSString *     property2;        ///< This is the second property and it does not work.
+@property (nonatomic, copy,   readwrite) NSString *     property3;        /**< This is the third property and it does not work. */
+@end
+// CHECK:  CommentAST=[
+// CHECK-NEXT:    (CXComment_FullComment
+// CHECK-NEXT:       (CXComment_Paragraph
+// CHECK-NEXT:         (CXComment_Text Text=[ This is the first property and it always worked.])))]
+// CHECK:  CommentAST=[
+// CHECK-NEXT:    (CXComment_FullComment
+// CHECK-NEXT:       (CXComment_Paragraph
+// CHECK-NEXT:         (CXComment_Text Text=[ This is the second property and it does not work.])))] 
+// CHECK:  CommentAST=[
+// CHECK-NEXT:    (CXComment_FullComment
+// CHECK-NEXT:       (CXComment_Paragraph
+// CHECK-NEXT:         (CXComment_Text Text=[ This is the third property and it does not work. ])))]