]> granicus.if.org Git - clang/commitdiff
documentation parsing: when providing code completion comment
authorFariborz Jahanian <fjahanian@apple.com>
Sat, 23 Mar 2013 01:10:45 +0000 (01:10 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Sat, 23 Mar 2013 01:10:45 +0000 (01:10 +0000)
for a getter used in property-dot syntax, if geter has its own
comment use it. // rdar://12791315

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

lib/Sema/SemaCodeComplete.cpp
test/Index/complete-documentation-properties.m

index 1cb264265aa6a1ad11e928cfc43cb6fdeb6756ae..34c83edcde7caacf6cccd74e162b51c17ccf96ec 100644 (file)
@@ -2550,11 +2550,18 @@ CodeCompletionResult::CreateCodeCompletionString(ASTContext &Ctx,
         if (M->isPropertyAccessor())
           if (const ObjCPropertyDecl *PDecl = M->findPropertyDecl())
             if (PDecl->getGetterName() == M->getSelector() &&
-                PDecl->getIdentifier() != M->getIdentifier())
-              if (const RawComment *RC = Ctx.getRawCommentForAnyRedecl(PDecl)) {
+                PDecl->getIdentifier() != M->getIdentifier()) {
+              if (const RawComment *RC = 
+                    Ctx.getRawCommentForAnyRedecl(M)) {
                 Result.addBriefComment(RC->getBriefText(Ctx));
                 Pattern->BriefComment = Result.getBriefComment();
               }
+              else if (const RawComment *RC = 
+                         Ctx.getRawCommentForAnyRedecl(PDecl)) {
+                Result.addBriefComment(RC->getBriefText(Ctx));
+                Pattern->BriefComment = Result.getBriefComment();
+              }
+            }
     }
     
     return Pattern;
index ea41d958da12385351eea7eb7e6609414a36937d..774a02021e742bd31bb532d99933cae8f6f7cc61 100644 (file)
 
 // RUN: env CINDEXTEST_COMPLETION_BRIEF_COMMENTS=1 c-index-test -code-completion-at=%s:52:12 %s | FileCheck -check-prefix=CC6 %s
 // CHECK-CC6: {TypedText GetterInClassExtension}{{.*}}(brief comment: This is PropertyInClassExtension) 
+
+@interface AnotherAppDelegate
+/**
+  \brief This is ReadonlyProperty
+*/
+@property (getter = ReadonlyGetter) int MyProperty;
+/**
+  \brief This is getter = ReadonlyGetter
+*/
+- (int) ReadonlyGetter;
+@end
+
+@implementation AnotherAppDelegate
+- (int) PropertyInPrimaryClass { 
+self.ReadonlyGetter;
+}
+@end
+// RUN: env CINDEXTEST_COMPLETION_BRIEF_COMMENTS=1 c-index-test -code-completion-at=%s:87:6 %s | FileCheck -check-prefix=CC7 %s
+// CHECK-CC7: {TypedText ReadonlyGetter}{{.*}}(brief comment: This is getter = ReadonlyGetter) 
+