[cfe-commits] r70949 - in /cfe/trunk: include/clang/Parse/AttributeList.h lib/Parse/AttributeList.cpp lib/Sema/SemaDeclAttr.cpp test/Analysis/retain-release-gc-only.m test/Analysis/retain-release.m

Ted Kremenek kremenek at apple.com
Mon May 4 17:21:59 PDT 2009


Author: kremenek
Date: Mon May  4 19:21:59 2009
New Revision: 70949

URL: http://llvm.org/viewvc/llvm-project?rev=70949&view=rev
Log:
Rename ownership attributes:
 ns_ownership_returns -> ns_returns_owned
 ns_ownership_retain -> ns_retains
 ns_ownership_release -> ns_releases
 cf_ownership_retain ->  cf_retains
 cf_ownership_release -> cf_releases

Modified:
    cfe/trunk/include/clang/Parse/AttributeList.h
    cfe/trunk/lib/Parse/AttributeList.cpp
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
    cfe/trunk/test/Analysis/retain-release-gc-only.m
    cfe/trunk/test/Analysis/retain-release.m

Modified: cfe/trunk/include/clang/Parse/AttributeList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/AttributeList.h?rev=70949&r1=70948&r2=70949&view=diff

==============================================================================
--- cfe/trunk/include/clang/Parse/AttributeList.h (original)
+++ cfe/trunk/include/clang/Parse/AttributeList.h Mon May  4 19:21:59 2009
@@ -76,11 +76,11 @@
     AT_nothrow,
     AT_nsobject,
     AT_objc_exception,
-    AT_cf_ownership_release,        // Clang-specific.
-    AT_cf_ownership_retain,         // Clang-specific.
-    AT_ns_ownership_release,          // Clang-specific.
-    AT_ns_ownership_retain,           // Clang-specific.
-    AT_ns_returns_ownership,          // Clang-specific.
+    AT_cf_releases,        // Clang-specific.
+    AT_cf_retains,         // Clang-specific.
+    AT_ns_releases,          // Clang-specific.
+    AT_ns_retains,           // Clang-specific.
+    AT_ns_returns_owned,          // Clang-specific.
     AT_objc_gc,
     AT_overloadable,            // Clang-specific.
     AT_packed,

Modified: cfe/trunk/lib/Parse/AttributeList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/AttributeList.cpp?rev=70949&r1=70948&r2=70949&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/AttributeList.cpp (original)
+++ cfe/trunk/lib/Parse/AttributeList.cpp Mon May  4 19:21:59 2009
@@ -106,12 +106,16 @@
     if (!memcmp(Str, "format_arg", 10))
       return IgnoredAttribute; // FIXME: printf format string checking.
     if (!memcmp(Str, "gnu_inline", 10)) return AT_gnu_inline;
+    if (!memcmp(Str, "cf_retains", 10)) return AT_cf_retains;
+    if (!memcmp(Str, "ns_retains", 10)) return AT_ns_retains;      
     break;
   case 11:
     if (!memcmp(Str, "weak_import", 11)) return AT_weak_import;
     if (!memcmp(Str, "vector_size", 11)) return AT_vector_size;
     if (!memcmp(Str, "constructor", 11)) return AT_constructor;
     if (!memcmp(Str, "unavailable", 11)) return AT_unavailable;
+    if (!memcmp(Str, "cf_releases", 11)) return AT_cf_releases;
+    if (!memcmp(Str, "ns_releases", 11)) return AT_ns_releases;      
     break;
   case 12:
     if (!memcmp(Str, "overloadable", 12)) return AT_overloadable;
@@ -126,6 +130,9 @@
   case 15:
     if (!memcmp(Str, "ext_vector_type", 15)) return AT_ext_vector_type;
     break;
+  case 16:
+    if (!memcmp(Str, "ns_returns_owned", 16)) return AT_ns_returns_owned;
+    break;      
   case 17:
     if (!memcmp(Str, "transparent_union", 17)) return AT_transparent_union;
     if (!memcmp(Str, "analyzer_noreturn", 17)) return AT_analyzer_noreturn;
@@ -133,20 +140,6 @@
   case 18:
     if (!memcmp(Str, "warn_unused_result", 18)) return AT_warn_unused_result;
     break;
-  case 19:
-    if (!memcmp(Str, "cf_ownership_retain", 19))
-      return AT_cf_ownership_retain;
-    if (!memcmp(Str, "ns_ownership_retain", 19))
-      return AT_ns_ownership_retain;      
-    break;      
-  case 20:
-    if (!memcmp(Str, "cf_ownership_release", 20))
-      return AT_cf_ownership_release;
-    if (!memcmp(Str, "ns_ownership_release", 20))
-      return AT_ns_ownership_release;
-    if (!memcmp(Str, "ns_returns_ownership", 20))
-      return AT_ns_returns_ownership;
-    break;
   case 22:
     if (!memcmp(Str, "no_instrument_function", 22))
       return AT_no_instrument_function;

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=70949&r1=70948&r2=70949&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon May  4 19:21:59 2009
@@ -1552,7 +1552,7 @@
 
   if (!isa<ObjCMethodDecl>(d) && !isa<FunctionDecl>(d)) {
     S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) <<
-      "ns_returns_ownership" << 3 /* function or method */;
+      "ns_returns_owned" << 3 /* function or method */;
     return;
   }
   
@@ -1569,14 +1569,14 @@
       default:
         assert(0 && "invalid ownership attribute");
         return;
-      case AttributeList::AT_cf_ownership_release:
-        name = "cf_ownership_release"; break;
-      case AttributeList::AT_cf_ownership_retain:
-        name = "cf_ownership_retain"; break;
-      case AttributeList::AT_ns_ownership_release:
-        name = "ns_ownership_release"; break;
-      case AttributeList::AT_ns_ownership_retain:
-        name = "ns_ownership_retain"; break;
+      case AttributeList::AT_cf_releases:
+        name = "cf_releases"; break;
+      case AttributeList::AT_cf_retains:
+        name = "cf_retains"; break;
+      case AttributeList::AT_ns_releases:
+        name = "ns_releases"; break;
+      case AttributeList::AT_ns_retains:
+        name = "ns_retains"; break;
     };
 
     S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) << name
@@ -1589,13 +1589,13 @@
     default:
       assert(0 && "invalid ownership attribute");
       return;
-    case AttributeList::AT_cf_ownership_release:
+    case AttributeList::AT_cf_releases:
       d->addAttr(::new (S.Context) CFOwnershipReleaseAttr()); return;      
-    case AttributeList::AT_cf_ownership_retain:
+    case AttributeList::AT_cf_retains:
       d->addAttr(::new (S.Context) CFOwnershipRetainAttr()); return;
-    case AttributeList::AT_ns_ownership_release:
+    case AttributeList::AT_ns_releases:
       d->addAttr(::new (S.Context) NSOwnershipReleaseAttr());   return;
-    case AttributeList::AT_ns_ownership_retain:
+    case AttributeList::AT_ns_retains:
       d->addAttr(::new (S.Context) NSOwnershipRetainAttr());   return;
   }
 }
@@ -1638,13 +1638,13 @@
   case AttributeList::AT_nothrow:     HandleNothrowAttr   (D, Attr, S); break;
 
   // Checker-specific.
-  case AttributeList::AT_cf_ownership_release:     
-  case AttributeList::AT_cf_ownership_retain:
+  case AttributeList::AT_cf_releases:     
+  case AttributeList::AT_cf_retains:
       HandleNSOwnershipAttr(D, Attr, S); break;
-  case AttributeList::AT_ns_ownership_release:
-  case AttributeList::AT_ns_ownership_retain:
+  case AttributeList::AT_ns_releases:
+  case AttributeList::AT_ns_retains:
       HandleNSOwnershipAttr(D, Attr, S, true); break;
-  case AttributeList::AT_ns_returns_ownership:
+  case AttributeList::AT_ns_returns_owned:
     HandleNSOwnershipReturnsAttr(D, Attr, S); break;
 
   case AttributeList::AT_packed:      HandlePackedAttr    (D, Attr, S); break;

Modified: cfe/trunk/test/Analysis/retain-release-gc-only.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release-gc-only.m?rev=70949&r1=70948&r2=70949&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/retain-release-gc-only.m (original)
+++ cfe/trunk/test/Analysis/retain-release-gc-only.m Mon May  4 19:21:59 2009
@@ -129,11 +129,11 @@
 //===----------------------------------------------------------------------===//
 
 @interface TestOwnershipAttr : NSObject
-- (NSString*) returnsAnOwnedString __attribute__((ns_returns_ownership));
-- (void) myRetain:(id)__attribute__((ns_ownership_retain))obj;
-- (void) myCFRetain:(id)__attribute__((cf_ownership_retain))obj;
-- (void) myRelease:(id)__attribute__((ns_ownership_release))obj;
-- (void) myCFRelease:(id)__attribute__((cf_ownership_release))obj;
+- (NSString*) returnsAnOwnedString __attribute__((ns_returns_owned));
+- (void) myRetain:(id)__attribute__((ns_retains))obj;
+- (void) myCFRetain:(id)__attribute__((cf_retains))obj;
+- (void) myRelease:(id)__attribute__((ns_releases))obj;
+- (void) myCFRelease:(id)__attribute__((cf_releases))obj;
 @end
 
 void test_attr_1(TestOwnershipAttr *X) {

Modified: cfe/trunk/test/Analysis/retain-release.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release.m?rev=70949&r1=70948&r2=70949&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/retain-release.m (original)
+++ cfe/trunk/test/Analysis/retain-release.m Mon May  4 19:21:59 2009
@@ -431,19 +431,18 @@
 //===----------------------------------------------------------------------===//
 
 @interface TestOwnershipAttr : NSObject
-- (NSString*) returnsAnOwnedString  __attribute__((ns_returns_ownership));
-- (void) myRetain:(id)__attribute__((ns_ownership_retain))obj;
-- (void) myCFRetain:(id)__attribute__((cf_ownership_retain))obj;
-- (void) myRelease:(id)__attribute__((ns_ownership_release))obj;
-- (void) myCFRelease:(id)__attribute__((cf_ownership_release))obj;
-
-- (void) myRetain __attribute__((ns_ownership_retain));
-- (void) myRelease __attribute__((ns_ownership_release));
+- (NSString*) returnsAnOwnedString  __attribute__((ns_returns_owned));
+- (void) myRetain:(id)__attribute__((ns_retains))obj;
+- (void) myCFRetain:(id)__attribute__((cf_retains))obj;
+- (void) myRelease:(id)__attribute__((ns_releases))obj;
+- (void) myCFRelease:(id)__attribute__((cf_releases))obj;
+- (void) myRetain __attribute__((ns_retains));
+- (void) myRelease __attribute__((ns_releases));
 @end
 
 @interface TestAttrHelper : NSObject
 - (NSString*) createString:(TestOwnershipAttr*)X;
-- (NSString*) createStringAttr:(TestOwnershipAttr*)X __attribute__((ns_returns_ownership));
+- (NSString*) createStringAttr:(TestOwnershipAttr*)X __attribute__((ns_returns_owned));
 @end
 
 @implementation TestAttrHelper





More information about the cfe-commits mailing list