[cfe-commits] r134529 - in /cfe/trunk: include/clang/AST/DeclObjC.h lib/Sema/SemaType.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed Jul 6 13:48:48 PDT 2011
Author: fjahanian
Date: Wed Jul 6 15:48:48 2011
New Revision: 134529
URL: http://llvm.org/viewvc/llvm-project?rev=134529&view=rev
Log:
Some code cleanup of r134522
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/Sema/SemaType.cpp
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=134529&r1=134528&r2=134529&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Wed Jul 6 15:48:48 2011
@@ -641,6 +641,18 @@
return false;
}
+ /// isArcWeakrefUnavailable - Checks for a class or one of its super classes
+ /// to be incompatible with __weak references. Returns true if it is.
+ bool isArcWeakrefUnavailable() const {
+ const ObjCInterfaceDecl *Class = this;
+ while (Class) {
+ if (Class->hasAttr<ArcWeakrefUnavailableAttr>())
+ return true;
+ Class = Class->getSuperClass();
+ }
+ return false;
+ }
+
ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName,
ObjCInterfaceDecl *&ClassDeclared);
ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName) {
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=134529&r1=134528&r2=134529&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Wed Jul 6 15:48:48 2011
@@ -3212,21 +3212,14 @@
// objc_arc_weak_reference_unavailable
if (lifetime == Qualifiers::OCL_Weak) {
QualType T = type;
- if (T->isReferenceType()) {
- T = T->getAs<ReferenceType>()->getPointeeType();
- }
while (const PointerType *ptr = T->getAs<PointerType>())
T = ptr->getPointeeType();
if (const ObjCObjectPointerType *ObjT = T->getAs<ObjCObjectPointerType>()) {
ObjCInterfaceDecl *Class = ObjT->getInterfaceDecl();
- while (Class) {
- if (Class->hasAttr<ArcWeakrefUnavailableAttr>()) {
+ if (Class->isArcWeakrefUnavailable()) {
S.Diag(attr.getLoc(), diag::err_arc_unsupported_weak_class);
S.Diag(ObjT->getInterfaceDecl()->getLocation(),
diag::note_class_declared);
- break;
- }
- Class = Class->getSuperClass();
}
}
}
More information about the cfe-commits
mailing list