diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-02-27 00:46:06 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-02-27 00:46:06 +0000 |
commit | 664e860beb2550bef24fb8946192f61648a71d7f (patch) | |
tree | af19f6fb553b830c4008bbe374c9446b467e2621 | |
parent | 714b509bb4f8be76e6616944551efe7a6e8358cd (diff) |
comment parsing: Properties are considered like methods, and people
think of them as having return values that may be computed. Don't
warn when using @return in their comment. // rdar://13189938
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176147 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/CommentSema.h | 1 | ||||
-rw-r--r-- | lib/AST/CommentSema.cpp | 11 | ||||
-rw-r--r-- | test/Sema/nowarn-documentation-property.m | 15 |
3 files changed, 27 insertions, 0 deletions
diff --git a/include/clang/AST/CommentSema.h b/include/clang/AST/CommentSema.h index 97099bfe63..76957c23fc 100644 --- a/include/clang/AST/CommentSema.h +++ b/include/clang/AST/CommentSema.h @@ -201,6 +201,7 @@ public: void resolveParamCommandIndexes(const FullComment *FC); bool isFunctionDecl(); + bool isObjCPropertyDecl(); bool isTemplateOrSpecialization(); ArrayRef<const ParmVarDecl *> getParamVars(); diff --git a/lib/AST/CommentSema.cpp b/lib/AST/CommentSema.cpp index fd2b5b1810..73e49e71db 100644 --- a/lib/AST/CommentSema.cpp +++ b/lib/AST/CommentSema.cpp @@ -465,6 +465,9 @@ void Sema::checkReturnsCommand(const BlockCommandComment *Command) { } return; } + else if (isObjCPropertyDecl()) + return; + Diag(Command->getLocation(), diag::warn_doc_returns_not_attached_to_a_function_decl) << Command->getCommandName(Traits) @@ -652,6 +655,14 @@ bool Sema::isFunctionDecl() { inspectThisDecl(); return ThisDeclInfo->getKind() == DeclInfo::FunctionKind; } + +bool Sema::isObjCPropertyDecl() { + if (!ThisDeclInfo) + return false; + if (!ThisDeclInfo->IsFilled) + inspectThisDecl(); + return ThisDeclInfo->CurrentDecl->getKind() == Decl::ObjCProperty; +} bool Sema::isTemplateOrSpecialization() { if (!ThisDeclInfo) diff --git a/test/Sema/nowarn-documentation-property.m b/test/Sema/nowarn-documentation-property.m new file mode 100644 index 0000000000..af2b062912 --- /dev/null +++ b/test/Sema/nowarn-documentation-property.m @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-objc-root-class -Wdocumentation -verify %s +// expected-no-diagnostics +// rdar://13189938 + +@interface NSPredicate +/// The full predicate to be used for drawing objects from the store. +/// It is an AND of the parent's `prefixPredicate` (e.g., the selection for +/// volume number) and the `filterPredicate` (selection by matching the name). +/// @return `nil` if there is no search string, and no prefix. + +@property(readonly) NSPredicate *andPredicate; +/// The predicate that matches the string to be searched for. This +/// @return `nil` if there is no search string. +@property(readonly) NSPredicate *filterPredicate; +@end |