forked from OSchip/llvm-project
fix a bug handling typedefs in member expr codegen. Patch
by Seo Sanghyeon llvm-svn: 44455
This commit is contained in:
parent
b6a7b582ee
commit
1386de8757
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue