diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-04-18 08:54:40 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-18 08:54:40 +0000 |
commit | f3ef07cbe8f154ba373f42291132048687f80bf0 (patch) | |
tree | f1dc0824b7b506c1f43af0ba59613481ba5172af /lib/CodeGen/CGExpr.cpp | |
parent | 1139452ae326e96a11f9740e5fda7f995fd3a6be (diff) |
Use getAsPointerType instead of using getCanonicalType directly.
- <rdar://problem/6803995>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69435 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index f98e6748b2..a073c44256 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -825,13 +825,10 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) { BaseTypeSize)); } - QualType T = E->getBase()->getType(); - QualType ExprTy = getContext().getCanonicalType(T); - T = T->getAsPointerType()->getPointeeType(); - LValue LV = - LValue::MakeAddr(Builder.CreateGEP(Base, Idx, "arrayidx"), - ExprTy->getAsPointerType()->getPointeeType().getCVRQualifiers(), - getContext().getObjCGCAttrKind(T)); + QualType T = E->getBase()->getType()->getAsPointerType()->getPointeeType(); + LValue LV = LValue::MakeAddr(Builder.CreateGEP(Base, Idx, "arrayidx"), + T.getCVRQualifiers(), + getContext().getObjCGCAttrKind(T)); if (getContext().getLangOptions().ObjC1 && getContext().getLangOptions().getGCMode() != LangOptions::NonGC) LValue::SetObjCNonGC(LV, !E->isOBJCGCCandidate()); @@ -900,7 +897,7 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) { if (E->isArrow()) { BaseValue = EmitScalarExpr(BaseExpr); const PointerType *PTy = - cast<PointerType>(getContext().getCanonicalType(BaseExpr->getType())); + BaseExpr->getType()->getAsPointerType(); if (PTy->getPointeeType()->isUnionType()) isUnion = true; CVRQualifiers = PTy->getPointeeType().getCVRQualifiers(); @@ -1166,8 +1163,7 @@ LValue CodeGenFunction::EmitObjCIvarRefLValue(const ObjCIvarRefExpr *E) { QualType ObjectTy; if (E->isArrow()) { BaseValue = EmitScalarExpr(BaseExpr); - const PointerType *PTy = - cast<PointerType>(getContext().getCanonicalType(BaseExpr->getType())); + const PointerType *PTy = BaseExpr->getType()->getAsPointerType(); ObjectTy = PTy->getPointeeType(); CVRQualifiers = ObjectTy.getCVRQualifiers(); } else { |