fix a bug handling typedefs in member expr codegen. Patch

by Seo Sanghyeon

llvm-svn: 44455
This commit is contained in:
Chris Lattner 2007-11-30 18:02:19 +00:00
parent b6a7b582ee
commit 1386de8757
2 changed files with 11 additions and 2 deletions

View File

@ -393,10 +393,11 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
BaseValue = BaseLV.getAddress();
if (E->isArrow()) {
QualType PTy = cast<PointerType>(BaseExpr->getType())->getPointeeType();
QualType Ty = BaseExpr->getType();
Ty = cast<PointerType>(Ty.getCanonicalType())->getPointeeType();
BaseValue =
Builder.CreateBitCast(BaseValue,
llvm::PointerType::get(ConvertType(PTy)), "tmp");
llvm::PointerType::get(ConvertType(Ty)), "tmp");
}
} else
BaseValue = EmitScalarExpr(BaseExpr);

View File

@ -0,0 +1,8 @@
// RUN: clang -emit-llvm %s
typedef struct { int i; } Value;
typedef Value *PValue;
int get_value(PValue v) {
return v->i;
}