fix a bug handling typedefs in member expr codegen. Patch
by Seo Sanghyeon
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44455 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CodeGen/CGExpr.cpp b/CodeGen/CGExpr.cpp
index 8fcc948..a4aa6db 100644
--- a/CodeGen/CGExpr.cpp
+++ b/CodeGen/CGExpr.cpp
@@ -393,10 +393,11 @@
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);