diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-10-09 22:26:49 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-10-09 22:26:49 +0000 |
commit | f892c7fe6053e409eff12c97470aded3976fb103 (patch) | |
tree | d845a4249f6b4f9c07b86df020e60ef75eaca1c1 | |
parent | 0c83c8128b0e0befafb48899f3abff088c9a081c (diff) | |
download | bcm5719-llvm-f892c7fe6053e409eff12c97470aded3976fb103.tar.gz bcm5719-llvm-f892c7fe6053e409eff12c97470aded3976fb103.zip |
For the various CF and NS attributes, don't complain if the parameter
or return types are dependent. Fixes PR9049.
llvm-svn: 141518
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 8 | ||||
-rw-r--r-- | clang/test/SemaTemplate/attributes.cpp | 13 |
2 files changed, 19 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 38c0c4aef59..f76bb5879ac 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -3136,10 +3136,14 @@ static void handleLaunchBoundsAttr(Sema &S, Decl *D, const AttributeList &Attr){ //===----------------------------------------------------------------------===// static bool isValidSubjectOfNSAttribute(Sema &S, QualType type) { - return type->isObjCObjectPointerType() || S.Context.isObjCNSObjectType(type); + return type->isDependentType() || + type->isObjCObjectPointerType() || + S.Context.isObjCNSObjectType(type); } static bool isValidSubjectOfCFAttribute(Sema &S, QualType type) { - return type->isPointerType() || isValidSubjectOfNSAttribute(S, type); + return type->isDependentType() || + type->isPointerType() || + isValidSubjectOfNSAttribute(S, type); } static void handleNSConsumedAttr(Sema &S, Decl *D, const AttributeList &Attr) { diff --git a/clang/test/SemaTemplate/attributes.cpp b/clang/test/SemaTemplate/attributes.cpp index e208bd2b899..495f4a7ad38 100644 --- a/clang/test/SemaTemplate/attributes.cpp +++ b/clang/test/SemaTemplate/attributes.cpp @@ -19,3 +19,16 @@ namespace attribute_aligned { check_alignment<3>::t c3; // expected-note 2 {{in instantiation}} check_alignment<4>::t c4; } + +namespace PR9049 { + extern const void *CFRetain(const void *ref); + + template<typename T> __attribute__((cf_returns_retained)) + inline T WBCFRetain(T aValue) { return aValue ? (T)CFRetain(aValue) : (T)0; } + + + extern void CFRelease(const void *ref); + + template<typename T> + inline void WBCFRelease(__attribute__((cf_consumed)) T aValue) { if(aValue) CFRelease(aValue); } +} |