r177797 - documentation parsing: when providing code completion comment
Fariborz Jahanian
fjahanian at apple.com
Fri Mar 22 18:10:45 PDT 2013
Author: fjahanian
Date: Fri Mar 22 20:10:45 2013
New Revision: 177797
URL: http://llvm.org/viewvc/llvm-project?rev=177797&view=rev
Log:
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
Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/Index/complete-documentation-properties.m
Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=177797&r1=177796&r2=177797&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Mar 22 20:10:45 2013
@@ -2550,11 +2550,18 @@ CodeCompletionResult::CreateCodeCompleti
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;
Modified: cfe/trunk/test/Index/complete-documentation-properties.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-documentation-properties.m?rev=177797&r1=177796&r2=177797&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-documentation-properties.m (original)
+++ cfe/trunk/test/Index/complete-documentation-properties.m Fri Mar 22 20:10:45 2013
@@ -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)
+
+ at interface AnotherAppDelegate
+/**
+ \brief This is ReadonlyProperty
+*/
+ at property (getter = ReadonlyGetter) int MyProperty;
+/**
+ \brief This is getter = ReadonlyGetter
+*/
+- (int) ReadonlyGetter;
+ at end
+
+ at implementation AnotherAppDelegate
+- (int) PropertyInPrimaryClass {
+self.ReadonlyGetter;
+}
+ at 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)
+
More information about the cfe-commits
mailing list