return isa<PointerType>(CanonicalType.getUnqualifiedType());
}
inline bool Type::isBlockPointerType() const {
- return isa<BlockPointerType>(CanonicalType);
+ return isa<BlockPointerType>(CanonicalType.getUnqualifiedType());
}
inline bool Type::isReferenceType() const {
return isa<ReferenceType>(CanonicalType.getUnqualifiedType());
/// For now, sema will catch these as invalid.
/// The type qualifiers: const/volatile/restrict.
unsigned TypeQuals : 3;
- void destroy() {}
+ AttributeList *AttrList;
+ void destroy() {
+ delete AttrList;
+ }
};
struct MemberPointerTypeInfo {
case MemberPointer: return Mem.AttrList;
case Array: return 0;
case Function: return 0;
- case BlockPointer: return 0; // FIXME: Do blocks have attr list?
+ case BlockPointer: return Cls.AttrList;
}
}
/// getBlockPointer - Return a DeclaratorChunk for a block.
///
- static DeclaratorChunk getBlockPointer(unsigned TypeQuals,
- SourceLocation Loc) {
+ static DeclaratorChunk getBlockPointer(unsigned TypeQuals, SourceLocation Loc,
+ AttributeList *AL) {
DeclaratorChunk I;
I.Kind = BlockPointer;
I.Loc = Loc;
I.Cls.TypeQuals = TypeQuals;
+ I.Cls.AttrList = AL;
return I;
}
else
// Remember that we parsed a Block type, and remember the type-quals.
D.AddTypeInfo(DeclaratorChunk::getBlockPointer(DS.getTypeQualifiers(),
- Loc),
+ Loc, DS.TakeAttributes()),
SourceLocation());
} else {
// Is a reference
// RUN: clang-cc %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10 &&
-// RUN: grep "_Block_object_dispose" %t | count 4 &&
-// RUN: grep "__copy_helper_block_" %t | count 2 &&
-// RUN: grep "__destroy_helper_block_" %t | count 2 &&
+// RUN: grep "_Block_object_dispose" %t | count 6 &&
+// RUN: grep "__copy_helper_block_" %t | count 4 &&
+// RUN: grep "__destroy_helper_block_" %t | count 4 &&
// RUN: grep "__Block_byref_id_object_copy_" %t | count 2 &&
// RUN: grep "__Block_byref_id_object_dispose_" %t | count 2 &&
// RUN: grep "i32 135)" %t | count 0 &&
-// RUN: grep "_Block_object_assign" %t | count 3 &&
+// RUN: grep "_Block_object_assign" %t | count 4 &&
// RUN: grep "objc_read_weak" %t | count 2 &&
-// RUN: grep "objc_assign_weak" %t | count 2
+// RUN: grep "objc_assign_weak" %t | count 3
@interface NSDictionary @end
l = weakSelf;
weakSelf = l;
}
+
+void (^__weak b)(void);
+
+void test2() {
+ __block int i = 0;
+ b = ^ { ++i; };
+}