From b77792eabf5882cf9af8cc810599b20432fda6c2 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 26 Jul 2008 22:17:49 +0000 Subject: change more instances of QualType::getCanonicalType to call ASTContext::getCanonicalType instead (PR2189) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54105 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 9420f95ad1..448f7ec97c 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -404,18 +404,20 @@ LValue CodeGenFunction::EmitUnaryOpLValue(const UnaryOperator *E) { if (E->getOpcode() == UnaryOperator::Extension) return EmitLValue(E->getSubExpr()); + QualType ExprTy=CGM.getContext().getCanonicalType(E->getSubExpr()->getType()); switch (E->getOpcode()) { default: assert(0 && "Unknown unary operator lvalue!"); case UnaryOperator::Deref: return LValue::MakeAddr(EmitScalarExpr(E->getSubExpr()), - E->getSubExpr()->getType().getCanonicalType()->getAsPointerType() - ->getPointeeType().getCVRQualifiers()); + ExprTy->getAsPointerType()->getPointeeType() + .getCVRQualifiers()); case UnaryOperator::Real: case UnaryOperator::Imag: LValue LV = EmitLValue(E->getSubExpr()); unsigned Idx = E->getOpcode() == UnaryOperator::Imag; return LValue::MakeAddr(Builder.CreateStructGEP(LV.getAddress(), - Idx, "idx"),E->getSubExpr()->getType().getCVRQualifiers()); + Idx, "idx"), + ExprTy.getCVRQualifiers()); } } @@ -501,9 +503,11 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) { // size is a VLA. if (!E->getType()->isConstantSizeType()) assert(0 && "VLA idx not implemented"); + QualType ExprTy = CGM.getContext().getCanonicalType(E->getBase()->getType()); + return LValue::MakeAddr(Builder.CreateGEP(Base, Idx, "arrayidx"), - E->getBase()->getType().getCanonicalType()->getAsPointerType() - ->getPointeeType().getCVRQualifiers()); + ExprTy->getAsPointerType()->getPointeeType() + .getCVRQualifiers()); } static -- cgit v1.2.3