[cfe-commits] r147457 - in /cfe/trunk: include/clang/AST/DeclObjC.h include/clang/Basic/Attr.td include/clang/Sema/AttributeList.h lib/Sema/AttributeList.cpp lib/Sema/SemaDeclAttr.cpp
Fariborz Jahanian
fjahanian at apple.com
Tue Jan 3 10:45:41 PST 2012
Author: fjahanian
Date: Tue Jan 3 12:45:41 2012
New Revision: 147457
URL: http://llvm.org/viewvc/llvm-project?rev=147457&view=rev
Log:
objc: introduce objc_suppress_autosynthesis class
attributes for later use.
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Sema/AttributeList.h
cfe/trunk/lib/Sema/AttributeList.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=147457&r1=147456&r2=147457&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Tue Jan 3 12:45:41 2012
@@ -864,6 +864,18 @@
return false;
}
+ /// isObjCSuppressAutosynthesis - Checks that a class or one of its super
+ /// classes must not be auto-synthesized. Returns true if it must not be.
+ bool isObjCSuppressAutosynthesis() const {
+ const ObjCInterfaceDecl *Class = this;
+ while (Class) {
+ if (Class->hasAttr<ObjCSuppressAutosynthesisAttr>())
+ return true;
+ Class = Class->getSuperClass();
+ }
+ return false;
+ }
+
ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName,
ObjCInterfaceDecl *&ClassDeclared);
ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName) {
Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=147457&r1=147456&r2=147457&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Jan 3 12:45:41 2012
@@ -524,6 +524,10 @@
let Spellings = ["objc_arc_weak_reference_unavailable"];
}
+def ObjCSuppressAutosynthesis : InheritableAttr {
+ let Spellings = ["objc_suppress_autosynhesis"];
+}
+
def Unused : InheritableAttr {
let Spellings = ["unused"];
}
Modified: cfe/trunk/include/clang/Sema/AttributeList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/AttributeList.h?rev=147457&r1=147456&r2=147457&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/AttributeList.h (original)
+++ cfe/trunk/include/clang/Sema/AttributeList.h Tue Jan 3 12:45:41 2012
@@ -169,6 +169,7 @@
AT_analyzer_noreturn,
AT_annotate,
AT_arc_weakref_unavailable,
+ AT_objc_suppress_autosynthesis,
AT_availability, // Clang-specific
AT_base_check,
AT_blocks,
Modified: cfe/trunk/lib/Sema/AttributeList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AttributeList.cpp?rev=147457&r1=147456&r2=147457&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AttributeList.cpp (original)
+++ cfe/trunk/lib/Sema/AttributeList.cpp Tue Jan 3 12:45:41 2012
@@ -108,6 +108,7 @@
.Case("weak", AT_weak)
.Case("weakref", AT_weakref)
.Case("objc_arc_weak_reference_unavailable", AT_arc_weakref_unavailable)
+ .Case("objc_suppress_autosynthesis", AT_objc_suppress_autosynthesis)
.Case("pure", AT_pure)
.Case("mode", AT_mode)
.Case("used", AT_used)
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=147457&r1=147456&r2=147457&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Jan 3 12:45:41 2012
@@ -1579,6 +1579,18 @@
Attr.getRange(), S.Context));
}
+static void handleObjCSuppressAutosynthesisAttr(Sema &S, Decl *D,
+ const AttributeList &Attr) {
+ unsigned NumArgs = Attr.getNumArgs();
+ if (NumArgs > 0) {
+ S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 0;
+ return;
+ }
+
+ D->addAttr(::new (S.Context) ObjCSuppressAutosynthesisAttr(
+ Attr.getRange(), S.Context));
+}
+
static void handleAvailabilityAttr(Sema &S, Decl *D,
const AttributeList &Attr) {
IdentifierInfo *Platform = Attr.getParameterName();
@@ -3603,6 +3615,9 @@
case AttributeList::AT_arc_weakref_unavailable:
handleArcWeakrefUnavailableAttr (S, D, Attr);
break;
+ case AttributeList::AT_objc_suppress_autosynthesis:
+ handleObjCSuppressAutosynthesisAttr (S, D, Attr);
+ break;
case AttributeList::AT_unused: handleUnusedAttr (S, D, Attr); break;
case AttributeList::AT_returns_twice:
handleReturnsTwiceAttr(S, D, Attr);
More information about the cfe-commits
mailing list