diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-07-01 22:23:09 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-07-01 22:23:09 +0000 |
commit | 451ccc08929b3e99235fb2a25cd10935d2c2adec (patch) | |
tree | e6336c93c81ee2c7568bd6de082f5feaf6fa8151 | |
parent | 9ab661b163feda9ad40d07464a66c1c48360e238 (diff) | |
download | bcm5719-llvm-451ccc08929b3e99235fb2a25cd10935d2c2adec.tar.gz bcm5719-llvm-451ccc08929b3e99235fb2a25cd10935d2c2adec.zip |
Fix the warning that is emitted when an ownership attribute is applied incorrectly.
llvm-svn: 134278
-rw-r--r-- | clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 5 | ||||
-rw-r--r-- | clang/test/SemaObjC/arc.m | 2 |
3 files changed, 9 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index f895fc76971..7353f2e8131 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -1243,6 +1243,8 @@ def warn_function_attribute_wrong_type : Warning< "'%0' only applies to function types; type here is %1">; def warn_pointer_attribute_wrong_type : Warning< "'%0' only applies to pointer types; type here is %1">; +def warn_objc_object_attribute_wrong_type : Warning< + "'%0' only applies to objective-c object or block pointer types; type here is %1">; def warn_gnu_inline_attribute_requires_inline : Warning< "'gnu_inline' attribute requires function to be marked 'inline'," " attribute ignored">; diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index cc4389ef15b..cd4a5b50d8b 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -87,6 +87,11 @@ static void diagnoseBadTypeAttribute(Sema &S, const AttributeList &attr, useInstantiationLoc = true; break; + case AttributeList::AT_objc_ownership: + diagID = diag::warn_objc_object_attribute_wrong_type; + useInstantiationLoc = true; + break; + default: // Assume everything else was a function attribute. diagID = diag::warn_function_attribute_wrong_type; diff --git a/clang/test/SemaObjC/arc.m b/clang/test/SemaObjC/arc.m index 1202a2654e8..0ec44b93514 100644 --- a/clang/test/SemaObjC/arc.m +++ b/clang/test/SemaObjC/arc.m @@ -604,4 +604,6 @@ void test35(void) { __block id y; test36_helper(&y); ^{ test36_helper(&y); }(); + + __strong int non_objc_type; // expected-warning {{'__strong' only applies to objective-c object or block pointer types}} } |