]> granicus.if.org Git - clang/commitdiff
Fix the warning that is emitted when an ownership attribute is applied incorrectly.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 1 Jul 2011 22:23:09 +0000 (22:23 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Fri, 1 Jul 2011 22:23:09 +0000 (22:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134278 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaType.cpp
test/SemaObjC/arc.m

index f895fc7697110b5e0a369cdf4078ec1e11bcb4b5..7353f2e8131cff5d640563085cf9beb4ea7b5526 100644 (file)
@@ -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">;
index cc4389ef15b3da06321a3ca7baee3c208fe1a3a6..cd4a5b50d8b76a48b8be44345d0cf4eaaf65f034 100644 (file)
@@ -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;
index 1202a2654e8f62cc889cf993f98cb865ec9118a9..0ec44b93514bc8abca9f90bab27422289b59e471 100644 (file)
@@ -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}} 
 }