aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-26 22:17:49 +0000
committerChris Lattner <sabre@nondot.org>2008-07-26 22:17:49 +0000
commitb77792eabf5882cf9af8cc810599b20432fda6c2 (patch)
treeb3b695e135c5fa6692bdfc0c1da441140d64e2e5 /lib/CodeGen/CGExpr.cpp
parent806954b069dc1895353d4bd4f51e410869ac62f8 (diff)
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
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp14
1 files changed, 9 insertions, 5 deletions
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