[cfe-commits] r56554 - /cfe/trunk/lib/AST/ASTContext.cpp

Steve Naroff snaroff at apple.com
Wed Sep 24 08:05:54 PDT 2008


Author: snaroff
Date: Wed Sep 24 10:05:44 2008
New Revision: 56554

URL: http://llvm.org/viewvc/llvm-project?rev=56554&view=rev
Log:
Extend ASTContext::getTypeInfo() and ASTContext::getObjCEncodingForType() for BlockTypes.

This fixes <rdar://problem/6240616> clang: Assertion failed when using typedef and Blocks.

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

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

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Sep 24 10:05:44 2008
@@ -308,6 +308,12 @@
     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 @@
     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!");
 }





More information about the cfe-commits mailing list