summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-11-19 18:38:10 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-11-19 18:38:10 +0000
commita598b5286ecb24bdcd08f5737a0fc57f44c536fd (patch)
tree5150fba6f499fef1578935bf15e1768c0e2f4b8c /clang/lib/CodeGen
parent554689a3aa7b181239a767be623f812b4b5d6891 (diff)
downloadbcm5719-llvm-a598b5286ecb24bdcd08f5737a0fc57f44c536fd.tar.gz
bcm5719-llvm-a598b5286ecb24bdcd08f5737a0fc57f44c536fd.zip
More of objective-c's gc code-gen. Treat objective-c
objects as __strong when attribute unspecified. llvm-svn: 59654
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp6
-rw-r--r--clang/lib/CodeGen/CGValue.h7
2 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 3c283605e11..9e4d66a9478 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -542,6 +542,12 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
ObjCGCAttr::GCAttrTypes attrType = A->getType();
LValue::SetObjCType(attrType == ObjCGCAttr::Weak, attrType == ObjCGCAttr::Strong, LV);
}
+ else if (CGM.getLangOptions().ObjC1 &&
+ CGM.getLangOptions().getGCMode() != LangOptions::NonGC) {
+ QualType ExprTy = E->getType();
+ if (getContext().isObjCObjectPointerType(ExprTy))
+ LValue::SetObjCType(false, true, LV);
+ }
return LV;
} else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(E->getDecl())) {
return LValue::MakeAddr(CGM.GetAddrOfFunction(FD),
diff --git a/clang/lib/CodeGen/CGValue.h b/clang/lib/CodeGen/CGValue.h
index 1c60ebf14e9..5b6283f3c6c 100644
--- a/clang/lib/CodeGen/CGValue.h
+++ b/clang/lib/CodeGen/CGValue.h
@@ -162,10 +162,11 @@ public:
bool isObjCWeak() const { return ObjCType == Weak; }
bool isObjCStrong() const { return ObjCType == Strong; }
- static void SetObjCType(unsigned WeakVal, unsigned StrongVal, LValue& R) {
- if (WeakVal)
+ static void SetObjCType(bool isWeak, bool isStrong, LValue& R) {
+ assert(!(isWeak == true && isStrong == true));
+ if (isWeak)
R.ObjCType = Weak;
- else if (StrongVal)
+ else if (isStrong)
R.ObjCType = Strong;
}
OpenPOWER on IntegriCloud