diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-22 17:55:27 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-22 17:55:27 +0000 |
commit | c02ddb23c0a27ff95859b3eacab134613b0b1d1d (patch) | |
tree | 100e8fc8882e9bac9369263ee425882446291b36 /lib/Sema/SemaCodeComplete.cpp | |
parent | 82f0aff67d39c64805a048abfd9c91e72a5302b0 (diff) |
documentation parsing. Provide code completion comment
for self.GetterName where GetterName is the getter method
for a property with name different from the property name
(declared via a property getter attribute) // rdar://12791315
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177744 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 6bb954315a..1cb264265a 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -2541,6 +2541,20 @@ CodeCompletionResult::CreateCodeCompletionString(ASTContext &Ctx, if (Declaration) { Result.addParentContext(Declaration->getDeclContext()); Pattern->ParentName = Result.getParentName(); + // Provide code completion comment for self.GetterName where + // GetterName is the getter method for a property with name + // different from the property name (declared via a property + // getter attribute. + const NamedDecl *ND = Declaration; + if (const ObjCMethodDecl *M = dyn_cast<ObjCMethodDecl>(ND)) + 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)) { + Result.addBriefComment(RC->getBriefText(Ctx)); + Pattern->BriefComment = Result.getBriefComment(); + } } return Pattern; |