summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp19
1 files changed, 2 insertions, 17 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index f5a36542185..6d7bc034658 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -3733,24 +3733,9 @@ static void handleObjCBridgeRelatedAttr(Sema &S, Scope *Sc, Decl *D,
static void handleObjCDesignatedInitializer(Sema &S, Decl *D,
const AttributeList &Attr) {
- SourceLocation Loc = Attr.getLoc();
- ObjCMethodDecl *Method = cast<ObjCMethodDecl>(D);
-
- if (Method->getMethodFamily() != OMF_init) {
- S.Diag(D->getLocStart(), diag::err_attr_objc_designated_not_init_family)
- << SourceRange(Loc, Loc);
- return;
- }
- ObjCInterfaceDecl *IFace =
- dyn_cast<ObjCInterfaceDecl>(Method->getDeclContext());
- if (!IFace) {
- S.Diag(D->getLocStart(), diag::err_attr_objc_designated_not_interface)
- << SourceRange(Loc, Loc);
- return;
- }
-
+ ObjCInterfaceDecl *IFace = cast<ObjCInterfaceDecl>(D->getDeclContext());
IFace->setHasDesignatedInitializers();
- Method->addAttr(::new (S.Context)
+ D->addAttr(::new (S.Context)
ObjCDesignatedInitializerAttr(Attr.getRange(), S.Context,
Attr.getAttributeSpellingListIndex()));
}
OpenPOWER on IntegriCloud