]> granicus.if.org Git - clang/commitdiff
Fix a crash when ivar type is a __strong SEL. Fallout from
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 30 Nov 2009 18:43:52 +0000 (18:43 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 30 Nov 2009 18:43:52 +0000 (18:43 +0000)
recent change to make SEL a builtin type (fixes radar 7425510).

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

include/clang/AST/Type.h
lib/AST/ASTContext.cpp
test/CodeGenObjC/encode-test.m

index 5b09ef08ecfd04a569a6ec2cc49fdfbc9a7b1edc..349487f8794b9821f7b0ba406c989f4a8f6d5904 100644 (file)
@@ -2548,12 +2548,7 @@ public:
     return getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCClass) &&
            !Protocols.size();
   }
-
-  /// isObjCSelType - true for "SEL".
-  bool isObjCSelType() const {
-    return getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
-  }
-
+  
   /// isObjCQualifiedIdType - true for "id <p>".
   bool isObjCQualifiedIdType() const {
     return getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCId) &&
@@ -2902,8 +2897,8 @@ inline bool Type::isObjCClassType() const {
   return false;
 }
 inline bool Type::isObjCSelType() const {
-  if (const ObjCObjectPointerType *OPT = getAs<ObjCObjectPointerType>())
-    return OPT->isObjCSelType();
+  if (const PointerType *OPT = getAs<PointerType>())
+    return OPT->getPointeeType()->isSpecificBuiltinType(BuiltinType::ObjCSel);
   return false;
 }
 inline bool Type::isObjCBuiltinType() const {
index 2579a6e8795f98c66cf48b55d9d2b586bf3b0b99..6c9ecf089b986505938cdaf62d65b0adf5fa01de 100644 (file)
@@ -3413,13 +3413,13 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S,
     return;
   }
   
-  if (isObjCSelType(T)) {
-    S += ':';
-    return;
-  }
-
   if (const PointerType *PT = T->getAs<PointerType>()) {
+    if (PT->isObjCSelType()) {
+      S += ':';
+      return;
+    }
     QualType PointeeTy = PT->getPointeeType();
+    
     bool isReadOnly = false;
     // For historical/compatibility reasons, the read-only qualifier of the
     // pointee gets emitted _before_ the '^'.  The read-only qualifier of
index 7aca79a8f38fd657ac75633c58f085037870ec91..db8470b6bb2a19833b306211c61f13eba33ef3c4 100644 (file)
@@ -66,6 +66,7 @@ struct Innermost {
 @interface Test 
 {
        int ivar;
+         __attribute__((objc_gc(weak))) SEL selector;
 }
 -(void) test3: (Test*  [3] [4])b ; 
 - (SEL**) meth : (SEL) arg : (SEL*****) arg1 : (SEL*)arg2 : (SEL**) arg3;