]> granicus.if.org Git - clang/commitdiff
Rename attributes:
authorTed Kremenek <kremenek@apple.com>
Mon, 4 May 2009 17:29:57 +0000 (17:29 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 4 May 2009 17:29:57 +0000 (17:29 +0000)
'objc_ownership_cfretain' -> 'cf_ownership_retain'
'objc_ownership_cfrelease' -> 'cf_ownership_release'

Motivation: Core Foundation objects can be used in isolation from Objective-C,
and this forces users to reason about the separate semantics of CF objects. More
Sema support pending.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70884 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Attr.h
include/clang/Parse/AttributeList.h
lib/Analysis/CFRefCount.cpp
lib/Frontend/PCHReaderDecl.cpp
lib/Frontend/PCHWriter.cpp
lib/Parse/AttributeList.cpp
lib/Sema/SemaDeclAttr.cpp
test/Analysis/retain-release-gc-only.m
test/Analysis/retain-release.m

index cce69ca929b42b4d7529fb8c8fab4a6798d3102b..6d913de0a1a188ff8e46181e7a020be91ea184f8 100644 (file)
@@ -59,8 +59,8 @@ public:
     NonNull,
     ObjCException,
     ObjCNSObject,
-    ObjCOwnershipCFRelease,       // Clang/Checker-specific.
-    ObjCOwnershipCFRetain,        // Clang/Checker-specific.
+    CFOwnershipRelease,       // Clang/Checker-specific.
+    CFOwnershipRetain,        // Clang/Checker-specific.
     ObjCOwnershipMakeCollectable, // Clang/Checker-specific.
     ObjCOwnershipRelease,         // Clang/Checker-specific.
     ObjCOwnershipRetain,          // Clang/Checker-specific.
@@ -466,9 +466,9 @@ public:
 };
 
 // Checker-specific attributes.
-DEF_SIMPLE_ATTR(ObjCOwnershipCFRelease);
+DEF_SIMPLE_ATTR(CFOwnershipRelease);
 DEF_SIMPLE_ATTR(ObjCOwnershipRelease);
-DEF_SIMPLE_ATTR(ObjCOwnershipCFRetain);
+DEF_SIMPLE_ATTR(CFOwnershipRetain);
 DEF_SIMPLE_ATTR(ObjCOwnershipRetain);
 DEF_SIMPLE_ATTR(ObjCOwnershipMakeCollectable);
 DEF_SIMPLE_ATTR(ObjCOwnershipReturns);
index 15280431962e476401b9e42213e424124d6594be..5901fbd601bc3336116a2e39794279c612e2d270 100644 (file)
@@ -76,8 +76,8 @@ public:
     AT_nothrow,
     AT_nsobject,
     AT_objc_exception,
-    AT_objc_ownership_cfrelease,        // Clang-specific.
-    AT_objc_ownership_cfretain,         // Clang-specific.
+    AT_cf_ownership_release,        // Clang-specific.
+    AT_cf_ownership_retain,         // Clang-specific.
     AT_objc_ownership_make_collectable, // Clang-specific.
     AT_objc_ownership_release,          // Clang-specific.
     AT_objc_ownership_retain,           // Clang-specific.
index 711127b79d964a475ffca83c321e36c84a8f4a4d..f4b4b1185310dedb697313d3dec9d9a60a8359cb 100644 (file)
@@ -1107,11 +1107,11 @@ RetainSummaryManager::updateSummaryArgEffFromAnnotations(RetainSummary &Summ,
                                                          const ParmVarDecl *PD){
   if (PD->getAttr<ObjCOwnershipRetainAttr>())
     Summ.setArgEffect(AF, i, IncRefMsg);
-  else if (PD->getAttr<ObjCOwnershipCFRetainAttr>())
+  else if (PD->getAttr<CFOwnershipRetainAttr>())
     Summ.setArgEffect(AF, i, IncRef);
   else if (PD->getAttr<ObjCOwnershipReleaseAttr>())
     Summ.setArgEffect(AF, i, DecRefMsg);
-  else if (PD->getAttr<ObjCOwnershipCFReleaseAttr>())
+  else if (PD->getAttr<CFOwnershipReleaseAttr>())
     Summ.setArgEffect(AF, i, DecRef);
   else if (PD->getAttr<ObjCOwnershipMakeCollectableAttr>())
     Summ.setArgEffect(AF, i, MakeCollectable);  
index 22699e5716922185ec5c83ed5e2d0351d482ae12..29da2ab41d9bef70d31d5084898d75a0ee8eb7bc 100644 (file)
@@ -475,8 +475,8 @@ Attr *PCHReader::ReadAttributes() {
 
     SIMPLE_ATTR(ObjCException);
     SIMPLE_ATTR(ObjCNSObject);
-    SIMPLE_ATTR(ObjCOwnershipCFRelease);
-    SIMPLE_ATTR(ObjCOwnershipCFRetain);
+    SIMPLE_ATTR(CFOwnershipRelease);
+    SIMPLE_ATTR(CFOwnershipRetain);
     SIMPLE_ATTR(ObjCOwnershipMakeCollectable);
     SIMPLE_ATTR(ObjCOwnershipRelease);
     SIMPLE_ATTR(ObjCOwnershipRetain);
index 2db93c3bb936c7c543e07b586f42e98d245db738..2bec9d4239bc07d08d1333d3d8c000673007ebff 100644 (file)
@@ -1549,8 +1549,8 @@ void PCHWriter::WriteAttributeRecord(const Attr *Attr) {
 
     case Attr::ObjCException:
     case Attr::ObjCNSObject:
-    case Attr::ObjCOwnershipCFRelease:
-    case Attr::ObjCOwnershipCFRetain:
+    case Attr::CFOwnershipRelease:
+    case Attr::CFOwnershipRetain:
     case Attr::ObjCOwnershipMakeCollectable:
     case Attr::ObjCOwnershipRelease:
     case Attr::ObjCOwnershipRetain:
index cbd230cc519f2c1c71dd7a62f3b48a301a0d7f2f..a869601b47d9358e15710b800f3be6099ef18397 100644 (file)
@@ -133,6 +133,14 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) {
   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;
+    break;      
+  case 20:
+    if (!memcmp(Str, "cf_ownership_release", 20))
+      return AT_cf_ownership_release;
+    break;            
   case 21:
     if (!memcmp(Str, "objc_ownership_retain", 21))
       return AT_objc_ownership_retain;      
@@ -145,14 +153,6 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) {
     if (!memcmp(Str, "no_instrument_function", 22))
       return AT_no_instrument_function;
     break;
-  case 23:
-    if (!memcmp(Str, "objc_ownership_cfretain", 23))
-      return AT_objc_ownership_cfretain;
-    break;
-  case 24:
-    if (!memcmp(Str, "objc_ownership_cfrelease", 24))
-      return AT_objc_ownership_cfrelease;
-    break;      
   case 31:
     if (!memcmp(Str, "objc_ownership_make_collectable", 31))
       return AT_objc_ownership_make_collectable;
index 68d682ddab8995aaa4a6c2b0d37f8a8b5e582151..9a26c913fb46f6601e04e6b8f27420bc844eecb8 100644 (file)
@@ -1569,10 +1569,10 @@ static void HandleObjCOwnershipAttr(Decl *d, const AttributeList &Attr,
       default:
         assert(0 && "invalid ownership attribute");
         return;
-      case AttributeList::AT_objc_ownership_cfrelease:
-        name = "objc_ownership_cfrelease"; break;
-      case AttributeList::AT_objc_ownership_cfretain:
-        name = "objc_ownership_cfretain"; break;
+      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_objc_ownership_make_collectable:
         name = "objc_ownership_make_collectable"; break;
       case AttributeList::AT_objc_ownership_release:
@@ -1591,10 +1591,10 @@ static void HandleObjCOwnershipAttr(Decl *d, const AttributeList &Attr,
     default:
       assert(0 && "invalid ownership attribute");
       return;
-    case AttributeList::AT_objc_ownership_cfrelease:
-      d->addAttr(::new (S.Context) ObjCOwnershipCFReleaseAttr()); return;      
-    case AttributeList::AT_objc_ownership_cfretain:
-      d->addAttr(::new (S.Context) ObjCOwnershipCFRetainAttr()); return;
+    case AttributeList::AT_cf_ownership_release:
+      d->addAttr(::new (S.Context) CFOwnershipReleaseAttr()); return;      
+    case AttributeList::AT_cf_ownership_retain:
+      d->addAttr(::new (S.Context) CFOwnershipRetainAttr()); return;
     case AttributeList::AT_objc_ownership_make_collectable:
       d->addAttr(::new (S.Context) ObjCOwnershipMakeCollectableAttr()); return;
     case AttributeList::AT_objc_ownership_release:
@@ -1642,8 +1642,8 @@ static void ProcessDeclAttribute(Decl *D, const AttributeList &Attr, Sema &S) {
   case AttributeList::AT_nothrow:     HandleNothrowAttr   (D, Attr, S); break;
 
   // Checker-specific.
-  case AttributeList::AT_objc_ownership_cfrelease:     
-  case AttributeList::AT_objc_ownership_cfretain:
+  case AttributeList::AT_cf_ownership_release:     
+  case AttributeList::AT_cf_ownership_retain:
       HandleObjCOwnershipAttr(D, Attr, S); break;
   case AttributeList::AT_objc_ownership_make_collectable:
   case AttributeList::AT_objc_ownership_release:
index e008f4a795ab1cb9e331d38c7f240c75d9a86de1..3082b266c7f2eebd530e31d0e2c48d3d0ee149fd 100644 (file)
@@ -131,9 +131,9 @@ void f3() {
 @interface TestOwnershipAttr : NSObject
 - (NSString*) returnsAnOwnedString __attribute__((objc_ownership_returns));
 - (void) myRetain:(id)__attribute__((objc_ownership_retain))obj;
-- (void) myCFRetain:(id)__attribute__((objc_ownership_cfretain))obj;
+- (void) myCFRetain:(id)__attribute__((cf_ownership_retain))obj;
 - (void) myRelease:(id)__attribute__((objc_ownership_release))obj;
-- (void) myCFRelease:(id)__attribute__((objc_ownership_cfrelease))obj;
+- (void) myCFRelease:(id)__attribute__((cf_ownership_release))obj;
 - (void) makeCollectable:(id)__attribute__((objc_ownership_make_collectable))obj;
 @end
 
index 93d461329b27ac7ccd5879863fa260361b5ffb42..c0de303d2189ffc0c2e24079a27eaaf67cd8c0e8 100644 (file)
@@ -433,9 +433,9 @@ void rdar6704930(unsigned char *s, unsigned int length) {
 @interface TestOwnershipAttr : NSObject
 - (NSString*) returnsAnOwnedString  __attribute__((objc_ownership_returns));
 - (void) myRetain:(id)__attribute__((objc_ownership_retain))obj;
-- (void) myCFRetain:(id)__attribute__((objc_ownership_cfretain))obj;
+- (void) myCFRetain:(id)__attribute__((cf_ownership_retain))obj;
 - (void) myRelease:(id)__attribute__((objc_ownership_release))obj;
-- (void) myCFRelease:(id)__attribute__((objc_ownership_cfrelease))obj;
+- (void) myCFRelease:(id)__attribute__((cf_ownership_release))obj;
 
 - (void) myRetain __attribute__((objc_ownership_retain));
 - (void) myRelease __attribute__((objc_ownership_release));