]> granicus.if.org Git - clang/commitdiff
Rename attributes 'objc_ownership...' to 'ns_ownership...'.
authorTed Kremenek <kremenek@apple.com>
Mon, 4 May 2009 19:10:19 +0000 (19:10 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 4 May 2009 19:10:19 +0000 (19:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70897 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 6d913de0a1a188ff8e46181e7a020be91ea184f8..41ea065447a2ebe24d43e384cd405573579572d6 100644 (file)
@@ -61,10 +61,10 @@ public:
     ObjCNSObject,
     CFOwnershipRelease,       // Clang/Checker-specific.
     CFOwnershipRetain,        // Clang/Checker-specific.
-    ObjCOwnershipMakeCollectable, // Clang/Checker-specific.
-    ObjCOwnershipRelease,         // Clang/Checker-specific.
-    ObjCOwnershipRetain,          // Clang/Checker-specific.
-    ObjCOwnershipReturns,         // Clang/Checker-specific.
+    NSOwnershipMakeCollectable, // Clang/Checker-specific.
+    NSOwnershipRelease,         // Clang/Checker-specific.
+    NSOwnershipRetain,          // Clang/Checker-specific.
+    NSOwnershipReturns,         // Clang/Checker-specific.
     Overloadable, // Clang-specific
     Packed,
     Pure,
@@ -467,11 +467,11 @@ public:
 
 // Checker-specific attributes.
 DEF_SIMPLE_ATTR(CFOwnershipRelease);
-DEF_SIMPLE_ATTR(ObjCOwnershipRelease);
+DEF_SIMPLE_ATTR(NSOwnershipRelease);
 DEF_SIMPLE_ATTR(CFOwnershipRetain);
-DEF_SIMPLE_ATTR(ObjCOwnershipRetain);
-DEF_SIMPLE_ATTR(ObjCOwnershipMakeCollectable);
-DEF_SIMPLE_ATTR(ObjCOwnershipReturns);
+DEF_SIMPLE_ATTR(NSOwnershipRetain);
+DEF_SIMPLE_ATTR(NSOwnershipMakeCollectable);
+DEF_SIMPLE_ATTR(NSOwnershipReturns);
 
 #undef DEF_SIMPLE_ATTR
   
index 5901fbd601bc3336116a2e39794279c612e2d270..84a180b5e3abd91417183c50115e873c27d25e3c 100644 (file)
@@ -78,10 +78,10 @@ public:
     AT_objc_exception,
     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.
-    AT_objc_ownership_returns,          // Clang-specific.
+    AT_ns_ownership_make_collectable, // Clang-specific.
+    AT_ns_ownership_release,          // Clang-specific.
+    AT_ns_ownership_retain,           // Clang-specific.
+    AT_ns_ownership_returns,          // Clang-specific.
     AT_objc_gc,
     AT_overloadable,            // Clang-specific.
     AT_packed,
index f4b4b1185310dedb697313d3dec9d9a60a8359cb..54843d534a42de92084ead402bb98f193e9b4880 100644 (file)
@@ -1105,15 +1105,15 @@ void
 RetainSummaryManager::updateSummaryArgEffFromAnnotations(RetainSummary &Summ,
                                                          unsigned i,
                                                          const ParmVarDecl *PD){
-  if (PD->getAttr<ObjCOwnershipRetainAttr>())
+  if (PD->getAttr<NSOwnershipRetainAttr>())
     Summ.setArgEffect(AF, i, IncRefMsg);
   else if (PD->getAttr<CFOwnershipRetainAttr>())
     Summ.setArgEffect(AF, i, IncRef);
-  else if (PD->getAttr<ObjCOwnershipReleaseAttr>())
+  else if (PD->getAttr<NSOwnershipReleaseAttr>())
     Summ.setArgEffect(AF, i, DecRefMsg);
   else if (PD->getAttr<CFOwnershipReleaseAttr>())
     Summ.setArgEffect(AF, i, DecRef);
-  else if (PD->getAttr<ObjCOwnershipMakeCollectableAttr>())
+  else if (PD->getAttr<NSOwnershipMakeCollectableAttr>())
     Summ.setArgEffect(AF, i, MakeCollectable);  
 }
 
@@ -1125,7 +1125,7 @@ RetainSummaryManager::updateSummaryFromAnnotations(RetainSummary &Summ,
   
   // Determine if there is a special return effect for this method.
   if (isTrackedObjCObjectType(FD->getResultType())) {
-    if (FD->getAttr<ObjCOwnershipReturnsAttr>()) {
+    if (FD->getAttr<NSOwnershipReturnsAttr>()) {
       Summ.setRetEffect(isGCEnabled()
                         ? RetEffect::MakeGCNotOwned()
                         : RetEffect::MakeOwned(RetEffect::ObjC, true));
@@ -1147,7 +1147,7 @@ RetainSummaryManager::updateSummaryFromAnnotations(RetainSummary &Summ,
   
   // Determine if there is a special return effect for this method.
   if (isTrackedObjCObjectType(MD->getResultType())) {
-    if (MD->getAttr<ObjCOwnershipReturnsAttr>()) {
+    if (MD->getAttr<NSOwnershipReturnsAttr>()) {
       Summ.setRetEffect(isGCEnabled()
                         ? RetEffect::MakeGCNotOwned()
                         : RetEffect::MakeOwned(RetEffect::ObjC, true));
@@ -1161,9 +1161,9 @@ RetainSummaryManager::updateSummaryFromAnnotations(RetainSummary &Summ,
     updateSummaryArgEffFromAnnotations(Summ, i, *I);
   
   // Determine any effects on the receiver.
-  if (MD->getAttr<ObjCOwnershipRetainAttr>())
+  if (MD->getAttr<NSOwnershipRetainAttr>())
     Summ.setReceiverEffect(IncRefMsg);
-  else if (MD->getAttr<ObjCOwnershipReleaseAttr>())
+  else if (MD->getAttr<NSOwnershipReleaseAttr>())
     Summ.setReceiverEffect(DecRefMsg);
 }
 
index 29da2ab41d9bef70d31d5084898d75a0ee8eb7bc..bed010d7da7c74721e1fe5ded08b244cb90e4fae 100644 (file)
@@ -477,10 +477,10 @@ Attr *PCHReader::ReadAttributes() {
     SIMPLE_ATTR(ObjCNSObject);
     SIMPLE_ATTR(CFOwnershipRelease);
     SIMPLE_ATTR(CFOwnershipRetain);
-    SIMPLE_ATTR(ObjCOwnershipMakeCollectable);
-    SIMPLE_ATTR(ObjCOwnershipRelease);
-    SIMPLE_ATTR(ObjCOwnershipRetain);
-    SIMPLE_ATTR(ObjCOwnershipReturns);
+    SIMPLE_ATTR(NSOwnershipMakeCollectable);
+    SIMPLE_ATTR(NSOwnershipRelease);
+    SIMPLE_ATTR(NSOwnershipRetain);
+    SIMPLE_ATTR(NSOwnershipReturns);
     SIMPLE_ATTR(Overloadable);
     UNSIGNED_ATTR(Packed);
     SIMPLE_ATTR(Pure);
index 2bec9d4239bc07d08d1333d3d8c000673007ebff..2d4d8e44477ee12736bc5dfbd44708e52e2dd9a6 100644 (file)
@@ -1551,10 +1551,10 @@ void PCHWriter::WriteAttributeRecord(const Attr *Attr) {
     case Attr::ObjCNSObject:
     case Attr::CFOwnershipRelease:
     case Attr::CFOwnershipRetain:
-    case Attr::ObjCOwnershipMakeCollectable:
-    case Attr::ObjCOwnershipRelease:
-    case Attr::ObjCOwnershipRetain:
-    case Attr::ObjCOwnershipReturns:
+    case Attr::NSOwnershipMakeCollectable:
+    case Attr::NSOwnershipRelease:
+    case Attr::NSOwnershipRetain:
+    case Attr::NSOwnershipReturns:
     case Attr::Overloadable:
       break;
 
index a869601b47d9358e15710b800f3be6099ef18397..c68a5b735bd87e4dbbc619bc70c7ac1436258c23 100644 (file)
@@ -136,26 +136,24 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) {
   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;
-    break;            
-  case 21:
-    if (!memcmp(Str, "objc_ownership_retain", 21))
-      return AT_objc_ownership_retain;      
+    if (!memcmp(Str, "ns_ownership_release", 20))
+      return AT_ns_ownership_release;
+    if (!memcmp(Str, "ns_ownership_returns", 20))
+      return AT_ns_ownership_returns;
     break;
   case 22:
-    if (!memcmp(Str, "objc_ownership_returns", 22))
-      return AT_objc_ownership_returns;
-    if (!memcmp(Str, "objc_ownership_release", 22))
-      return AT_objc_ownership_release;
     if (!memcmp(Str, "no_instrument_function", 22))
       return AT_no_instrument_function;
     break;
-  case 31:
-    if (!memcmp(Str, "objc_ownership_make_collectable", 31))
-      return AT_objc_ownership_make_collectable;
+  case 29:
+    if (!memcmp(Str, "ns_ownership_make_collectable", 29))
+      return AT_ns_ownership_make_collectable;
     break;
   }  
   return UnknownAttribute;
index 9a26c913fb46f6601e04e6b8f27420bc844eecb8..8aec8c8e07fc8713a51993d950a0c4dfd14fd7aa 100644 (file)
@@ -1547,19 +1547,19 @@ static void HandleRegparmAttr(Decl *d, const AttributeList &Attr, Sema &S) {
 // Checker-specific attribute handlers.
 //===----------------------------------------------------------------------===//
 
-static void HandleObjCOwnershipReturnsAttr(Decl *d, const AttributeList &Attr,
+static void HandleNSOwnershipReturnsAttr(Decl *d, const AttributeList &Attr,
                                            Sema &S) {
 
   if (!isa<ObjCMethodDecl>(d) && !isa<FunctionDecl>(d)) {
     S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) <<
-      "objc_ownership_returns" << 3 /* function or method */;
+      "ns_ownership_returns" << 3 /* function or method */;
     return;
   }
   
-  d->addAttr(::new (S.Context) ObjCOwnershipReturnsAttr());
+  d->addAttr(::new (S.Context) NSOwnershipReturnsAttr());
 }
 
-static void HandleObjCOwnershipAttr(Decl *d, const AttributeList &Attr,
+static void HandleNSOwnershipAttr(Decl *d, const AttributeList &Attr,
                                     Sema &S, bool attachToMethodDecl = false) {
   
   if (!isa<ParmVarDecl>(d) && (!attachToMethodDecl || !isa<ObjCMethodDecl>(d))){
@@ -1573,12 +1573,12 @@ static void HandleObjCOwnershipAttr(Decl *d, const AttributeList &Attr,
         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:
-        name = "objc_ownership_release"; break;
-      case AttributeList::AT_objc_ownership_retain:
-        name = "objc_ownership_retain"; break;
+      case AttributeList::AT_ns_ownership_make_collectable:
+        name = "ns_ownership_make_collectable"; break;
+      case AttributeList::AT_ns_ownership_release:
+        name = "ns_ownership_release"; break;
+      case AttributeList::AT_ns_ownership_retain:
+        name = "ns_ownership_retain"; break;
     };
 
     S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) << name
@@ -1595,12 +1595,12 @@ static void HandleObjCOwnershipAttr(Decl *d, const AttributeList &Attr,
       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:
-      d->addAttr(::new (S.Context) ObjCOwnershipReleaseAttr());   return;
-    case AttributeList::AT_objc_ownership_retain:
-      d->addAttr(::new (S.Context) ObjCOwnershipRetainAttr());   return;
+    case AttributeList::AT_ns_ownership_make_collectable:
+      d->addAttr(::new (S.Context) NSOwnershipMakeCollectableAttr()); return;
+    case AttributeList::AT_ns_ownership_release:
+      d->addAttr(::new (S.Context) NSOwnershipReleaseAttr());   return;
+    case AttributeList::AT_ns_ownership_retain:
+      d->addAttr(::new (S.Context) NSOwnershipRetainAttr());   return;
   }
 }
 
@@ -1644,13 +1644,13 @@ static void ProcessDeclAttribute(Decl *D, const AttributeList &Attr, Sema &S) {
   // Checker-specific.
   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:
-  case AttributeList::AT_objc_ownership_retain:
-      HandleObjCOwnershipAttr(D, Attr, S, true); break;
-  case AttributeList::AT_objc_ownership_returns:
-    HandleObjCOwnershipReturnsAttr(D, Attr, S); break;
+      HandleNSOwnershipAttr(D, Attr, S); break;
+  case AttributeList::AT_ns_ownership_make_collectable:
+  case AttributeList::AT_ns_ownership_release:
+  case AttributeList::AT_ns_ownership_retain:
+      HandleNSOwnershipAttr(D, Attr, S, true); break;
+  case AttributeList::AT_ns_ownership_returns:
+    HandleNSOwnershipReturnsAttr(D, Attr, S); break;
 
   case AttributeList::AT_packed:      HandlePackedAttr    (D, Attr, S); break;
   case AttributeList::AT_section:     HandleSectionAttr   (D, Attr, S); break;
index 3082b266c7f2eebd530e31d0e2c48d3d0ee149fd..79f9f4c1e596852f1014618f8b1c04aeb7cef560 100644 (file)
@@ -129,12 +129,12 @@ void f3() {
 //===----------------------------------------------------------------------===//
 
 @interface TestOwnershipAttr : NSObject
-- (NSString*) returnsAnOwnedString __attribute__((objc_ownership_returns));
-- (void) myRetain:(id)__attribute__((objc_ownership_retain))obj;
+- (NSString*) returnsAnOwnedString __attribute__((ns_ownership_returns));
+- (void) myRetain:(id)__attribute__((ns_ownership_retain))obj;
 - (void) myCFRetain:(id)__attribute__((cf_ownership_retain))obj;
-- (void) myRelease:(id)__attribute__((objc_ownership_release))obj;
+- (void) myRelease:(id)__attribute__((ns_ownership_release))obj;
 - (void) myCFRelease:(id)__attribute__((cf_ownership_release))obj;
-- (void) makeCollectable:(id)__attribute__((objc_ownership_make_collectable))obj;
+- (void) makeCollectable:(id)__attribute__((ns_ownership_make_collectable))obj;
 @end
 
 void test_attr_1(TestOwnershipAttr *X) {
index c0de303d2189ffc0c2e24079a27eaaf67cd8c0e8..84225c7b09362b3bb9288499c26ab1e81d160a3c 100644 (file)
@@ -431,19 +431,19 @@ 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;
+- (NSString*) returnsAnOwnedString  __attribute__((ns_ownership_returns));
+- (void) myRetain:(id)__attribute__((ns_ownership_retain))obj;
 - (void) myCFRetain:(id)__attribute__((cf_ownership_retain))obj;
-- (void) myRelease:(id)__attribute__((objc_ownership_release))obj;
+- (void) myRelease:(id)__attribute__((ns_ownership_release))obj;
 - (void) myCFRelease:(id)__attribute__((cf_ownership_release))obj;
 
-- (void) myRetain __attribute__((objc_ownership_retain));
-- (void) myRelease __attribute__((objc_ownership_release));
+- (void) myRetain __attribute__((ns_ownership_retain));
+- (void) myRelease __attribute__((ns_ownership_release));
 @end
 
 @interface TestAttrHelper : NSObject
 - (NSString*) createString:(TestOwnershipAttr*)X;
-- (NSString*) createStringAttr:(TestOwnershipAttr*)X __attribute__((objc_ownership_returns));
+- (NSString*) createStringAttr:(TestOwnershipAttr*)X __attribute__((ns_ownership_returns));
 @end
 
 @implementation TestAttrHelper