diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-23 01:10:45 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-23 01:10:45 +0000 |
commit | be8bc67b66f73f3ee22a01e960439b103cd96cd6 (patch) | |
tree | 5d5964facb71fd0af952a21f8d8bfd5ec67f02f9 | |
parent | 4d96c8d7140b95ac2608422b59c9749a0c5b6981 (diff) | |
download | bcm5719-llvm-be8bc67b66f73f3ee22a01e960439b103cd96cd6.tar.gz bcm5719-llvm-be8bc67b66f73f3ee22a01e960439b103cd96cd6.zip |
documentation parsing: when providing code completion comment
for a getter used in property-dot syntax, if geter has its own
comment use it. // rdar://12791315
llvm-svn: 177797
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 11 | ||||
-rw-r--r-- | clang/test/Index/complete-documentation-properties.m | 20 |
2 files changed, 29 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 1cb264265aa..34c83edcde7 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -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; diff --git a/clang/test/Index/complete-documentation-properties.m b/clang/test/Index/complete-documentation-properties.m index ea41d958da1..774a02021e7 100644 --- a/clang/test/Index/complete-documentation-properties.m +++ b/clang/test/Index/complete-documentation-properties.m @@ -70,3 +70,23 @@ // 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) + |