diff options
-rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 4bb5fd1a4f..628bfb0788 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -686,7 +686,14 @@ ScalarExprEmitter::VisitSizeOfAlignOfExpr(const SizeOfAlignOfExpr *E) { Align /= 8; // Return alignment in bytes, not bits. return llvm::ConstantInt::get(llvm::APInt(ResultWidth, Align)); } - + if (TypeToSize->isObjCInterfaceType()) { + ObjCInterfaceDecl *OI = TypeToSize->getAsObjCInterfaceType()->getDecl(); + const RecordDecl *RD = CGF.getContext().addRecordToClass(OI); + const Type *Key = + CGF.getContext().getTagDeclType( + const_cast<TagDecl*>(dyn_cast<TagDecl>(RD))).getTypePtr(); + TypeToSize = Key->getDesugaredType(); + } std::pair<uint64_t, unsigned> Info = CGF.getContext().getTypeInfo(TypeToSize); uint64_t Val = E->isSizeOf() ? Info.first : Info.second; |