[cfe-commits] r134285 - in /cfe/trunk: lib/AST/ASTContext.cpp lib/Sema/SemaType.cpp test/SemaObjCXX/arc-type-conversion.mm
Argyrios Kyrtzidis
akyrtzi at gmail.com
Fri Jul 1 16:01:46 PDT 2011
Author: akirtzidis
Date: Fri Jul 1 18:01:46 2011
New Revision: 134285
URL: http://llvm.org/viewvc/llvm-project?rev=134285&view=rev
Log:
-Fix mistake in ASTContext::getInnerObjCOwnership noticed by Doug
-Remove unnecessary 'return'.
-Remove unnecessary 'if' check (llvm_unreachable make sure attrStr will be non-null)
-Add a test of transferring ownership to a reference cast type.
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/SemaObjCXX/arc-type-conversion.mm
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=134285&r1=134284&r2=134285&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Fri Jul 1 18:01:46 2011
@@ -3523,7 +3523,7 @@
else if (const PointerType *PT = T->getAs<PointerType>())
T = PT->getPointeeType();
else if (const ReferenceType *RT = T->getAs<ReferenceType>())
- RT->getPointeeType();
+ T = RT->getPointeeType();
else
break;
}
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=134285&r1=134284&r2=134285&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Fri Jul 1 18:01:46 2011
@@ -2546,7 +2546,6 @@
qs.addObjCLifetime(ownership);
declSpecTy = S.Context.getQualifiedType(declSpecTy, qs);
}
- return;
}
static void transferARCOwnershipToDeclaratorChunk(TypeProcessingState &state,
@@ -2570,8 +2569,6 @@
case Qualifiers::OCL_Weak: attrStr = "weak"; break;
case Qualifiers::OCL_Autoreleasing: attrStr = "autoreleasing"; break;
}
- if (!attrStr)
- return;
// If there wasn't one, add one (with an invalid source location
// so that we don't make an AttributedType for it).
Modified: cfe/trunk/test/SemaObjCXX/arc-type-conversion.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/arc-type-conversion.mm?rev=134285&r1=134284&r2=134285&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/arc-type-conversion.mm (original)
+++ cfe/trunk/test/SemaObjCXX/arc-type-conversion.mm Fri Jul 1 18:01:46 2011
@@ -203,6 +203,7 @@
void ownership_transfer_in_cast(void *vp, Block *pblk) {
__strong NSString **sip2 = static_cast<NSString **>(static_cast<__strong id *>(vp));
+ __strong NSString **&si2pref = static_cast<NSString **&>(sip2);
__weak NSString **wip2 = static_cast<NSString **>(static_cast<__weak id *>(vp));
__autoreleasing id *aip2 = static_cast<id *>(static_cast<__autoreleasing id *>(vp));
__unsafe_unretained id *uip2 = static_cast<id *>(static_cast<__unsafe_unretained id *>(vp));
More information about the cfe-commits
mailing list