aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-09-24 15:05:44 +0000
committerSteve Naroff <snaroff@apple.com>2008-09-24 15:05:44 +0000
commit485eeff9ba73376c8e01179bf1a501b1723446cb (patch)
treec2bc46db40332c098b629e18a9426ac6bcdc2127
parentcafd9089a4745414eedb93d0b543d9d22c6b55ae (diff)
Extend ASTContext::getTypeInfo() and ASTContext::getObjCEncodingForType() for BlockTypes.
This fixes <rdar://problem/6240616> clang: Assertion failed when using typedef and Blocks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56554 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/ASTContext.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 4757ea98e5..b0ce9eb26d 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -308,6 +308,12 @@ ASTContext::getTypeInfo(QualType T) {
Width = Target.getPointerWidth(0);
Align = Target.getPointerAlign(0);
break;
+ case Type::BlockPointer: {
+ unsigned AS = cast<BlockPointerType>(T)->getPointeeType().getAddressSpace();
+ Width = Target.getPointerWidth(AS);
+ Align = Target.getPointerAlign(AS);
+ break;
+ }
case Type::Pointer: {
unsigned AS = cast<PointerType>(T)->getPointeeType().getAddressSpace();
Width = Target.getPointerWidth(AS);
@@ -1668,6 +1674,8 @@ void ASTContext::getObjCEncodingForType(QualType T, std::string& S,
S += '}';
} else if (T->isEnumeralType()) {
S += 'i';
+ } else if (T->isBlockPointerType()) {
+ S += '^'; // This type string is the same as general pointers.
} else
assert(0 && "@encode for type not implemented!");
}