summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-18 08:54:40 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-18 08:54:40 +0000
commit41595d43d5fce5f8f344a641dd4204694c72f604 (patch)
tree02498ea850d225d83afb9469faf1de2b157b2ff7
parentb685be0c1e9ad74ae9b48a676ec8099990f6add7 (diff)
downloadbcm5719-llvm-41595d43d5fce5f8f344a641dd4204694c72f604.tar.gz
bcm5719-llvm-41595d43d5fce5f8f344a641dd4204694c72f604.zip
Use getAsPointerType instead of using getCanonicalType directly.
- <rdar://problem/6803995> llvm-svn: 69435
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp16
-rw-r--r--clang/test/CodeGenObjC/attr-strong.c9
2 files changed, 15 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index f98e6748b21..a073c442561 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/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 {
diff --git a/clang/test/CodeGenObjC/attr-strong.c b/clang/test/CodeGenObjC/attr-strong.c
new file mode 100644
index 00000000000..ca833344943
--- /dev/null
+++ b/clang/test/CodeGenObjC/attr-strong.c
@@ -0,0 +1,9 @@
+// RUN: clang -emit-llvm -S -o %t %s
+
+struct s0 {
+ void *a;
+};
+struct s0 * __attribute__((objc_gc(strong))) g0;
+void f0(void) {
+ g0->a = 0;
+}
OpenPOWER on IntegriCloud