]> granicus.if.org Git - clang/commitdiff
Couple of helpers for objc's gc attributes.
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 19 Feb 2009 00:22:47 +0000 (00:22 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 19 Feb 2009 00:22:47 +0000 (00:22 +0000)
No change in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64989 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Type.h
lib/Sema/SemaDecl.cpp

index 644be13f5f766353013be5f8bc0c950566d54e63..7554b697e3c416f2b4d58056bced8acb363ec9ac 100644 (file)
@@ -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;
index 9cd5bc8069456e599f6d50bdda5bdc7d0c725a19..294be70488263a73b5fe6bc6668e5e201673fef0 100644 (file)
@@ -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)