summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-02-18 21:49:28 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-02-18 21:49:28 +0000
commit96207699013c52344b58c2a9a979c9ba7ac256b0 (patch)
tree9bb88ecc61a5853d2e0c3b2f121311ac298c013e /clang/lib/AST/ASTContext.cpp
parent778c62ccb5456f01ad1aeea7871d15b0d5e18fc8 (diff)
downloadbcm5719-llvm-96207699013c52344b58c2a9a979c9ba7ac256b0.tar.gz
bcm5719-llvm-96207699013c52344b58c2a9a979c9ba7ac256b0.zip
Some refactoring and simplificaiotn of objc's gc
ir gen. llvm-svn: 64954
Diffstat (limited to 'clang/lib/AST/ASTContext.cpp')
-rw-r--r--clang/lib/AST/ASTContext.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 9198bf71cda..bd9279fb500 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -2390,6 +2390,22 @@ bool ASTContext::isObjCObjectPointerType(QualType Ty) const {
return isObjCNSObjectType(Ty);
}
+/// getObjCGCAttr - Returns one of GCNone, Weak or Strong objc's
+/// garbage collection attribute.
+///
+QualType::GCAttrTypes ASTContext::getObjCGCAttrKind(const QualType &Ty) const {
+ QualType::GCAttrTypes attr = QualType::GCNone;
+ if (getLangOptions().ObjC1 &&
+ getLangOptions().getGCMode() != LangOptions::NonGC) {
+ attr = Ty.getObjCGCAttr();
+ // Default behavious under objective-c's gc is for objective-c pointers
+ // be treated as though they were declared as __strong.
+ if (attr == QualType::GCNone && isObjCObjectPointerType(Ty))
+ attr = QualType::Strong;
+ }
+ return attr;
+}
+
//===----------------------------------------------------------------------===//
// Type Compatibility Testing
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud