summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-12-03 21:11:49 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-12-03 21:11:49 +0000
commit925d54c10a8b78356169247997ea4d2b23fbe26d (patch)
tree01256f0e56cc5ee13dbabc62e9f0ec5c658f7171 /lib/Sema/SemaExprObjC.cpp
parent2d9de48ac1dfe1d03cabb015846e24cebc408d4d (diff)
downloadclang-925d54c10a8b78356169247997ea4d2b23fbe26d.tar.gz
clang-925d54c10a8b78356169247997ea4d2b23fbe26d.tar.bz2
clang-925d54c10a8b78356169247997ea4d2b23fbe26d.tar.xz
[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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprObjC.cpp')
-rw-r--r--lib/Sema/SemaExprObjC.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index c452306457..5faab1e083 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -2476,6 +2476,16 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
}
}
+ if (Method && Method->getMethodFamily() == OMF_init &&
+ getCurFunction()->ObjCIsSecondaryInit &&
+ (SuperLoc.isValid() || isSelfExpr(Receiver))) {
+ if (SuperLoc.isValid()) {
+ Diag(SelLoc, diag::warn_objc_secondary_init_super_init_call);
+ } else {
+ getCurFunction()->ObjCWarnForNoInitDelegation = false;
+ }
+ }
+
// Check the message arguments.
unsigned NumArgs = ArgsIn.size();
Expr **Args = ArgsIn.data();