[cfe-commits] r134278 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaType.cpp test/SemaObjC/arc.m

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Jul 1 15:23:09 PDT 2011


Author: akirtzidis
Date: Fri Jul  1 17:23:09 2011
New Revision: 134278

URL: http://llvm.org/viewvc/llvm-project?rev=134278&view=rev
Log:
Fix the warning that is emitted when an ownership attribute is applied incorrectly.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/SemaType.cpp
    cfe/trunk/test/SemaObjC/arc.m

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=134278&r1=134277&r2=134278&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jul  1 17:23:09 2011
@@ -1243,6 +1243,8 @@
   "'%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">;

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=134278&r1=134277&r2=134278&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Fri Jul  1 17:23:09 2011
@@ -87,6 +87,11 @@
     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;

Modified: cfe/trunk/test/SemaObjC/arc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/arc.m?rev=134278&r1=134277&r2=134278&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/arc.m (original)
+++ cfe/trunk/test/SemaObjC/arc.m Fri Jul  1 17:23:09 2011
@@ -604,4 +604,6 @@
   __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}} 
 }





More information about the cfe-commits mailing list