diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-12-04 20:32:50 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-12-04 20:32:50 +0000 |
commit | 1a2519a7e9743825dd19c5e958040b3350791b64 (patch) | |
tree | ba2b8bbaa9385199c85da067826ce3b7382611ae /clang/lib/Sema/SemaDeclAttr.cpp | |
parent | 17c357342a7397aca0710613b72139a7256836f8 (diff) | |
download | bcm5719-llvm-1a2519a7e9743825dd19c5e958040b3350791b64.tar.gz bcm5719-llvm-1a2519a7e9743825dd19c5e958040b3350791b64.zip |
ObjectiveC - Introducing objc_bridge_related attribute
which specifies couple of (optional) method selectors
for bridging a CFobject to or from an ObjectiveC
object. This is wip. // rdsr://15499111
llvm-svn: 196408
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index c587452aeb4..5414453efc1 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -3713,6 +3713,24 @@ static void handleObjCBridgeMutableAttr(Sema &S, Scope *Sc, Decl *D, Attr.getAttributeSpellingListIndex())); } +static void handleObjCBridgeRelatedAttr(Sema &S, Scope *Sc, Decl *D, + const AttributeList &Attr) { + IdentifierInfo *RelatedClass = + Attr.isArgIdent(0) ? Attr.getArgAsIdent(0)->Ident : 0; + if (!RelatedClass) { + S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << Attr.getName() << 0; + return; + } + IdentifierInfo *ClassMethod = + Attr.getArgAsIdent(1) ? Attr.getArgAsIdent(1)->Ident : 0; + IdentifierInfo *InstanceMethod = + Attr.getArgAsIdent(2) ? Attr.getArgAsIdent(2)->Ident : 0; + D->addAttr(::new (S.Context) + ObjCBridgeRelatedAttr(Attr.getRange(), S.Context, RelatedClass, + ClassMethod, InstanceMethod, + Attr.getAttributeSpellingListIndex())); +} + static void handleObjCDesignatedInitializer(Sema &S, Decl *D, const AttributeList &Attr) { SourceLocation Loc = Attr.getLoc(); @@ -3986,6 +4004,9 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, case AttributeList::AT_ObjCBridgeMutable: handleObjCBridgeMutableAttr(S, scope, D, Attr); break; + + case AttributeList::AT_ObjCBridgeRelated: + handleObjCBridgeRelatedAttr(S, scope, D, Attr); break; case AttributeList::AT_ObjCDesignatedInitializer: handleObjCDesignatedInitializer(S, D, Attr); break; |