[objc] Emit warning when the implementation of a secondary initializer calls on
super another initializer and when the implementation does not delegate to
another initializer via a call on 'self'.
A secondary initializer is an initializer method not marked as a designated
initializer within a class that has at least one initializer marked as a
designated initializer.
llvm-svn: 196318
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index f243c0e..dc8e66d 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9826,6 +9826,10 @@
diag::note_objc_designated_init_marked_here);
getCurFunction()->ObjCWarnForNoDesignatedInitChain = false;
}
+ if (getCurFunction()->ObjCWarnForNoInitDelegation) {
+ Diag(MD->getLocation(), diag::warn_objc_secondary_init_missing_init_call);
+ getCurFunction()->ObjCWarnForNoInitDelegation = false;
+ }
} else {
return 0;
}