diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-02-19 00:22:47 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-02-19 00:22:47 +0000 |
commit | f6123ca578eb8aabb76ecce7df6857482017f502 (patch) | |
tree | f010be5c00fa6ac5007019b0be16e2370e6a9c18 | |
parent | 9b76143b09a601dc3990b55934f02097f093a699 (diff) |
Couple of helpers for objc's gc attributes.
No change in functionality.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64989 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/Type.h | 10 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index 644be13f5f..7554b697e3 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -195,6 +195,16 @@ public: /// GCAttrTypesAttr - Returns gc attribute of this type. inline QualType::GCAttrTypes getObjCGCAttr() const; + + /// isObjCGCWeak true when Type is objc's weak. + bool isObjCGCWeak() const { + return getObjCGCAttr() == Weak; + } + + /// isObjCGCStrong true when Type is objc's strong. + bool isObjCGCStrong() const { + return getObjCGCAttr() == Strong; + } /// Emit - Serialize a QualType to Bitcode. void Emit(llvm::Serializer& S) const; diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 9cd5bc8069..294be70488 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -3510,7 +3510,7 @@ Sema::DeclTy *Sema::ActOnField(Scope *S, DeclTy *TagD, } ProcessDeclAttributes(NewFD, D); - if (T.getObjCGCAttr() == QualType::Weak) + if (T.isObjCGCWeak()) Diag(Loc, diag::warn_attribute_weak_on_field); if (D.getInvalidType() || InvalidDecl) |