forked from OSchip/llvm-project
Rename attributes:
'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. llvm-svn: 70884
This commit is contained in:
parent
0b0ee3c49d
commit
5dbfa3fadd
|
@ -59,8 +59,8 @@ public:
|
||||||
NonNull,
|
NonNull,
|
||||||
ObjCException,
|
ObjCException,
|
||||||
ObjCNSObject,
|
ObjCNSObject,
|
||||||
ObjCOwnershipCFRelease, // Clang/Checker-specific.
|
CFOwnershipRelease, // Clang/Checker-specific.
|
||||||
ObjCOwnershipCFRetain, // Clang/Checker-specific.
|
CFOwnershipRetain, // Clang/Checker-specific.
|
||||||
ObjCOwnershipMakeCollectable, // Clang/Checker-specific.
|
ObjCOwnershipMakeCollectable, // Clang/Checker-specific.
|
||||||
ObjCOwnershipRelease, // Clang/Checker-specific.
|
ObjCOwnershipRelease, // Clang/Checker-specific.
|
||||||
ObjCOwnershipRetain, // Clang/Checker-specific.
|
ObjCOwnershipRetain, // Clang/Checker-specific.
|
||||||
|
@ -466,9 +466,9 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Checker-specific attributes.
|
// Checker-specific attributes.
|
||||||
DEF_SIMPLE_ATTR(ObjCOwnershipCFRelease);
|
DEF_SIMPLE_ATTR(CFOwnershipRelease);
|
||||||
DEF_SIMPLE_ATTR(ObjCOwnershipRelease);
|
DEF_SIMPLE_ATTR(ObjCOwnershipRelease);
|
||||||
DEF_SIMPLE_ATTR(ObjCOwnershipCFRetain);
|
DEF_SIMPLE_ATTR(CFOwnershipRetain);
|
||||||
DEF_SIMPLE_ATTR(ObjCOwnershipRetain);
|
DEF_SIMPLE_ATTR(ObjCOwnershipRetain);
|
||||||
DEF_SIMPLE_ATTR(ObjCOwnershipMakeCollectable);
|
DEF_SIMPLE_ATTR(ObjCOwnershipMakeCollectable);
|
||||||
DEF_SIMPLE_ATTR(ObjCOwnershipReturns);
|
DEF_SIMPLE_ATTR(ObjCOwnershipReturns);
|
||||||
|
|
|
@ -76,8 +76,8 @@ public:
|
||||||
AT_nothrow,
|
AT_nothrow,
|
||||||
AT_nsobject,
|
AT_nsobject,
|
||||||
AT_objc_exception,
|
AT_objc_exception,
|
||||||
AT_objc_ownership_cfrelease, // Clang-specific.
|
AT_cf_ownership_release, // Clang-specific.
|
||||||
AT_objc_ownership_cfretain, // Clang-specific.
|
AT_cf_ownership_retain, // Clang-specific.
|
||||||
AT_objc_ownership_make_collectable, // Clang-specific.
|
AT_objc_ownership_make_collectable, // Clang-specific.
|
||||||
AT_objc_ownership_release, // Clang-specific.
|
AT_objc_ownership_release, // Clang-specific.
|
||||||
AT_objc_ownership_retain, // Clang-specific.
|
AT_objc_ownership_retain, // Clang-specific.
|
||||||
|
|
|
@ -1107,11 +1107,11 @@ RetainSummaryManager::updateSummaryArgEffFromAnnotations(RetainSummary &Summ,
|
||||||
const ParmVarDecl *PD){
|
const ParmVarDecl *PD){
|
||||||
if (PD->getAttr<ObjCOwnershipRetainAttr>())
|
if (PD->getAttr<ObjCOwnershipRetainAttr>())
|
||||||
Summ.setArgEffect(AF, i, IncRefMsg);
|
Summ.setArgEffect(AF, i, IncRefMsg);
|
||||||
else if (PD->getAttr<ObjCOwnershipCFRetainAttr>())
|
else if (PD->getAttr<CFOwnershipRetainAttr>())
|
||||||
Summ.setArgEffect(AF, i, IncRef);
|
Summ.setArgEffect(AF, i, IncRef);
|
||||||
else if (PD->getAttr<ObjCOwnershipReleaseAttr>())
|
else if (PD->getAttr<ObjCOwnershipReleaseAttr>())
|
||||||
Summ.setArgEffect(AF, i, DecRefMsg);
|
Summ.setArgEffect(AF, i, DecRefMsg);
|
||||||
else if (PD->getAttr<ObjCOwnershipCFReleaseAttr>())
|
else if (PD->getAttr<CFOwnershipReleaseAttr>())
|
||||||
Summ.setArgEffect(AF, i, DecRef);
|
Summ.setArgEffect(AF, i, DecRef);
|
||||||
else if (PD->getAttr<ObjCOwnershipMakeCollectableAttr>())
|
else if (PD->getAttr<ObjCOwnershipMakeCollectableAttr>())
|
||||||
Summ.setArgEffect(AF, i, MakeCollectable);
|
Summ.setArgEffect(AF, i, MakeCollectable);
|
||||||
|
|
|
@ -475,8 +475,8 @@ Attr *PCHReader::ReadAttributes() {
|
||||||
|
|
||||||
SIMPLE_ATTR(ObjCException);
|
SIMPLE_ATTR(ObjCException);
|
||||||
SIMPLE_ATTR(ObjCNSObject);
|
SIMPLE_ATTR(ObjCNSObject);
|
||||||
SIMPLE_ATTR(ObjCOwnershipCFRelease);
|
SIMPLE_ATTR(CFOwnershipRelease);
|
||||||
SIMPLE_ATTR(ObjCOwnershipCFRetain);
|
SIMPLE_ATTR(CFOwnershipRetain);
|
||||||
SIMPLE_ATTR(ObjCOwnershipMakeCollectable);
|
SIMPLE_ATTR(ObjCOwnershipMakeCollectable);
|
||||||
SIMPLE_ATTR(ObjCOwnershipRelease);
|
SIMPLE_ATTR(ObjCOwnershipRelease);
|
||||||
SIMPLE_ATTR(ObjCOwnershipRetain);
|
SIMPLE_ATTR(ObjCOwnershipRetain);
|
||||||
|
|
|
@ -1549,8 +1549,8 @@ void PCHWriter::WriteAttributeRecord(const Attr *Attr) {
|
||||||
|
|
||||||
case Attr::ObjCException:
|
case Attr::ObjCException:
|
||||||
case Attr::ObjCNSObject:
|
case Attr::ObjCNSObject:
|
||||||
case Attr::ObjCOwnershipCFRelease:
|
case Attr::CFOwnershipRelease:
|
||||||
case Attr::ObjCOwnershipCFRetain:
|
case Attr::CFOwnershipRetain:
|
||||||
case Attr::ObjCOwnershipMakeCollectable:
|
case Attr::ObjCOwnershipMakeCollectable:
|
||||||
case Attr::ObjCOwnershipRelease:
|
case Attr::ObjCOwnershipRelease:
|
||||||
case Attr::ObjCOwnershipRetain:
|
case Attr::ObjCOwnershipRetain:
|
||||||
|
|
|
@ -133,6 +133,14 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) {
|
||||||
case 18:
|
case 18:
|
||||||
if (!memcmp(Str, "warn_unused_result", 18)) return AT_warn_unused_result;
|
if (!memcmp(Str, "warn_unused_result", 18)) return AT_warn_unused_result;
|
||||||
break;
|
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:
|
case 21:
|
||||||
if (!memcmp(Str, "objc_ownership_retain", 21))
|
if (!memcmp(Str, "objc_ownership_retain", 21))
|
||||||
return AT_objc_ownership_retain;
|
return AT_objc_ownership_retain;
|
||||||
|
@ -145,14 +153,6 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) {
|
||||||
if (!memcmp(Str, "no_instrument_function", 22))
|
if (!memcmp(Str, "no_instrument_function", 22))
|
||||||
return AT_no_instrument_function;
|
return AT_no_instrument_function;
|
||||||
break;
|
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:
|
case 31:
|
||||||
if (!memcmp(Str, "objc_ownership_make_collectable", 31))
|
if (!memcmp(Str, "objc_ownership_make_collectable", 31))
|
||||||
return AT_objc_ownership_make_collectable;
|
return AT_objc_ownership_make_collectable;
|
||||||
|
|
|
@ -1569,10 +1569,10 @@ static void HandleObjCOwnershipAttr(Decl *d, const AttributeList &Attr,
|
||||||
default:
|
default:
|
||||||
assert(0 && "invalid ownership attribute");
|
assert(0 && "invalid ownership attribute");
|
||||||
return;
|
return;
|
||||||
case AttributeList::AT_objc_ownership_cfrelease:
|
case AttributeList::AT_cf_ownership_release:
|
||||||
name = "objc_ownership_cfrelease"; break;
|
name = "cf_ownership_release"; break;
|
||||||
case AttributeList::AT_objc_ownership_cfretain:
|
case AttributeList::AT_cf_ownership_retain:
|
||||||
name = "objc_ownership_cfretain"; break;
|
name = "cf_ownership_retain"; break;
|
||||||
case AttributeList::AT_objc_ownership_make_collectable:
|
case AttributeList::AT_objc_ownership_make_collectable:
|
||||||
name = "objc_ownership_make_collectable"; break;
|
name = "objc_ownership_make_collectable"; break;
|
||||||
case AttributeList::AT_objc_ownership_release:
|
case AttributeList::AT_objc_ownership_release:
|
||||||
|
@ -1591,10 +1591,10 @@ static void HandleObjCOwnershipAttr(Decl *d, const AttributeList &Attr,
|
||||||
default:
|
default:
|
||||||
assert(0 && "invalid ownership attribute");
|
assert(0 && "invalid ownership attribute");
|
||||||
return;
|
return;
|
||||||
case AttributeList::AT_objc_ownership_cfrelease:
|
case AttributeList::AT_cf_ownership_release:
|
||||||
d->addAttr(::new (S.Context) ObjCOwnershipCFReleaseAttr()); return;
|
d->addAttr(::new (S.Context) CFOwnershipReleaseAttr()); return;
|
||||||
case AttributeList::AT_objc_ownership_cfretain:
|
case AttributeList::AT_cf_ownership_retain:
|
||||||
d->addAttr(::new (S.Context) ObjCOwnershipCFRetainAttr()); return;
|
d->addAttr(::new (S.Context) CFOwnershipRetainAttr()); return;
|
||||||
case AttributeList::AT_objc_ownership_make_collectable:
|
case AttributeList::AT_objc_ownership_make_collectable:
|
||||||
d->addAttr(::new (S.Context) ObjCOwnershipMakeCollectableAttr()); return;
|
d->addAttr(::new (S.Context) ObjCOwnershipMakeCollectableAttr()); return;
|
||||||
case AttributeList::AT_objc_ownership_release:
|
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;
|
case AttributeList::AT_nothrow: HandleNothrowAttr (D, Attr, S); break;
|
||||||
|
|
||||||
// Checker-specific.
|
// Checker-specific.
|
||||||
case AttributeList::AT_objc_ownership_cfrelease:
|
case AttributeList::AT_cf_ownership_release:
|
||||||
case AttributeList::AT_objc_ownership_cfretain:
|
case AttributeList::AT_cf_ownership_retain:
|
||||||
HandleObjCOwnershipAttr(D, Attr, S); break;
|
HandleObjCOwnershipAttr(D, Attr, S); break;
|
||||||
case AttributeList::AT_objc_ownership_make_collectable:
|
case AttributeList::AT_objc_ownership_make_collectable:
|
||||||
case AttributeList::AT_objc_ownership_release:
|
case AttributeList::AT_objc_ownership_release:
|
||||||
|
|
|
@ -131,9 +131,9 @@ void f3() {
|
||||||
@interface TestOwnershipAttr : NSObject
|
@interface TestOwnershipAttr : NSObject
|
||||||
- (NSString*) returnsAnOwnedString __attribute__((objc_ownership_returns));
|
- (NSString*) returnsAnOwnedString __attribute__((objc_ownership_returns));
|
||||||
- (void) myRetain:(id)__attribute__((objc_ownership_retain))obj;
|
- (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) 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;
|
- (void) makeCollectable:(id)__attribute__((objc_ownership_make_collectable))obj;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -433,9 +433,9 @@ void rdar6704930(unsigned char *s, unsigned int length) {
|
||||||
@interface TestOwnershipAttr : NSObject
|
@interface TestOwnershipAttr : NSObject
|
||||||
- (NSString*) returnsAnOwnedString __attribute__((objc_ownership_returns));
|
- (NSString*) returnsAnOwnedString __attribute__((objc_ownership_returns));
|
||||||
- (void) myRetain:(id)__attribute__((objc_ownership_retain))obj;
|
- (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) 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) myRetain __attribute__((objc_ownership_retain));
|
||||||
- (void) myRelease __attribute__((objc_ownership_release));
|
- (void) myRelease __attribute__((objc_ownership_release));
|
||||||
|
|
Loading…
Reference in New Issue