diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-02-18 21:49:28 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-02-18 21:49:28 +0000 |
commit | 4fd83ea566f4a0c083001c84b75da6cc8c99c1d6 (patch) | |
tree | 9f30de529516131aedbf0a5ef53ebec50c1ea977 /lib/AST/ASTContext.cpp | |
parent | ca2f3fdeedc4e4beea4f7572d6d975188d0bb5ef (diff) |
Some refactoring and simplificaiotn of objc's gc
ir gen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64954 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 9198bf71cd..bd9279fb50 100644 --- a/lib/AST/ASTContext.cpp +++ b/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 //===----------------------------------------------------------------------===// |