[cfe-commits] r90145 - in /cfe/trunk: include/clang/AST/Type.h lib/AST/ASTContext.cpp test/CodeGenObjC/encode-test.m

Fariborz Jahanian fjahanian at apple.com
Mon Nov 30 10:43:52 PST 2009


Author: fjahanian
Date: Mon Nov 30 12:43:52 2009
New Revision: 90145

URL: http://llvm.org/viewvc/llvm-project?rev=90145&view=rev
Log:
Fix a crash when ivar type is a __strong SEL. Fallout from
recent change to make SEL a builtin type (fixes radar 7425510).


Modified:
    cfe/trunk/include/clang/AST/Type.h
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/test/CodeGenObjC/encode-test.m

Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=90145&r1=90144&r2=90145&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Mon Nov 30 12:43:52 2009
@@ -2548,12 +2548,7 @@
     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 @@
   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 {

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=90145&r1=90144&r2=90145&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Nov 30 12:43:52 2009
@@ -3413,13 +3413,13 @@
     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

Modified: cfe/trunk/test/CodeGenObjC/encode-test.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/encode-test.m?rev=90145&r1=90144&r2=90145&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenObjC/encode-test.m (original)
+++ cfe/trunk/test/CodeGenObjC/encode-test.m Mon Nov 30 12:43:52 2009
@@ -66,6 +66,7 @@
 @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;





More information about the cfe-commits mailing list