diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-12-03 21:11:30 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-12-03 21:11:30 +0000 |
commit | 9ed9e5f31c1fe946a5c6c1ffb651052925570fd4 (patch) | |
tree | 605b946afd00d0cd5ed2e51a74d0b4a127aa8b0b /clang/lib/Sema/SemaDeclAttr.cpp | |
parent | d1438b446e7463db7207720321e0bdf5fc6654ea (diff) | |
download | bcm5719-llvm-9ed9e5f31c1fe946a5c6c1ffb651052925570fd4.tar.gz bcm5719-llvm-9ed9e5f31c1fe946a5c6c1ffb651052925570fd4.zip |
[objc] Introduce ObjCInterfaceDecl::getDesignatedInitializers() to get the
designated initializers of an interface.
If the interface declaration does not have methods marked as designated
initializers then the interface inherits the designated initializers of
its super class.
llvm-svn: 196315
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index b732fccacf8..c587452aeb4 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -3723,13 +3723,15 @@ static void handleObjCDesignatedInitializer(Sema &S, Decl *D, << SourceRange(Loc, Loc); return; } - DeclContext *DC = Method->getDeclContext(); - if (!isa<ObjCInterfaceDecl>(DC)) { + ObjCInterfaceDecl *IFace = + dyn_cast<ObjCInterfaceDecl>(Method->getDeclContext()); + if (!IFace) { S.Diag(D->getLocStart(), diag::err_attr_objc_designated_not_interface) << SourceRange(Loc, Loc); return; } + IFace->setHasDesignatedInitializers(); Method->addAttr(::new (S.Context) ObjCDesignatedInitializerAttr(Attr.getRange(), S.Context, Attr.getAttributeSpellingListIndex())); |