summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/Sema/Sema.h3
-rw-r--r--clang/lib/Sema/SemaChecking.cpp3
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp8
-rw-r--r--clang/test/SemaObjC/method-bad-param.m10
-rw-r--r--clang/test/SemaObjCXX/microsoft-abi-byval.mm14
5 files changed, 32 insertions, 6 deletions
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 71e2aaf5de4..82de36908cd 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -2244,7 +2244,8 @@ public:
CallExpr *CE, FunctionDecl *FD);
/// Helpers for dealing with blocks and functions.
- bool CheckParmsForFunctionDef(ParmVarDecl **Param, ParmVarDecl **ParamEnd,
+ bool CheckParmsForFunctionDef(ParmVarDecl *const *Param,
+ ParmVarDecl *const *ParamEnd,
bool CheckParameterNames);
void CheckCXXDefaultArguments(FunctionDecl *FD);
void CheckExtraCXXDefaultArguments(Declarator &D);
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 163d5fe849b..996f20cc91b 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5758,7 +5758,8 @@ void Sema::CheckBitFieldInitialization(SourceLocation InitLoc,
/// takes care of any checks that cannot be performed on the
/// declaration itself, e.g., that the types of each of the function
/// parameters are complete.
-bool Sema::CheckParmsForFunctionDef(ParmVarDecl **P, ParmVarDecl **PEnd,
+bool Sema::CheckParmsForFunctionDef(ParmVarDecl *const *P,
+ ParmVarDecl *const *PEnd,
bool CheckParameterNames) {
bool HasInvalidParm = false;
for (; P != PEnd; ++P) {
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 8ce4ef3e4bb..a818d37459e 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -324,15 +324,15 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
PushOnScopeChains(MDecl->getSelfDecl(), FnBodyScope);
PushOnScopeChains(MDecl->getCmdDecl(), FnBodyScope);
+ // The ObjC parser requires parameter names so there's no need to check.
+ CheckParmsForFunctionDef(MDecl->param_begin(), MDecl->param_end(),
+ /*CheckParameterNames=*/false);
+
// Introduce all of the other parameters into this scope.
for (ObjCMethodDecl::param_iterator PI = MDecl->param_begin(),
E = MDecl->param_end(); PI != E; ++PI) {
ParmVarDecl *Param = (*PI);
if (!Param->isInvalidDecl() &&
- RequireCompleteType(Param->getLocation(), Param->getType(),
- diag::err_typecheck_decl_incomplete_type))
- Param->setInvalidDecl();
- if (!Param->isInvalidDecl() &&
getLangOpts().ObjCAutoRefCount &&
!HasExplicitOwnershipAttr(*this, Param))
Diag(Param->getLocation(), diag::warn_arc_strong_pointer_objc_pointer) <<
diff --git a/clang/test/SemaObjC/method-bad-param.m b/clang/test/SemaObjC/method-bad-param.m
index 30aba7b9d0d..ad67a34edb0 100644
--- a/clang/test/SemaObjC/method-bad-param.m
+++ b/clang/test/SemaObjC/method-bad-param.m
@@ -46,3 +46,13 @@ enum bogus; // expected-note {{forward declaration of 'enum bogus'}}
- (int[6])arrayRet; // expected-error {{function cannot return array type 'int [6]'}}
- (int())funcRet; // expected-error {{function cannot return function type 'int ()'}}
@end
+
+@interface qux
+- (void) my_method: (int)arg; // expected-note {{method 'my_method:' declared here}}
+@end
+
+// FIXME: The diagnostic and recovery here could probably be improved.
+@implementation qux // expected-warning {{method definition for 'my_method:' not found}}
+- (void) my_method: (int) { // expected-error {{expected identifier}}
+}
+@end
diff --git a/clang/test/SemaObjCXX/microsoft-abi-byval.mm b/clang/test/SemaObjCXX/microsoft-abi-byval.mm
new file mode 100644
index 00000000000..f0c4caa9e06
--- /dev/null
+++ b/clang/test/SemaObjCXX/microsoft-abi-byval.mm
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -cxx-abi microsoft -Wno-objc-root-class %s
+
+class Foo {
+ ~Foo(); // expected-note {{implicitly declared private here}}
+};
+
+@interface bar
+- (void) my_method: (Foo)arg;
+@end
+
+@implementation bar
+- (void) my_method: (Foo)arg { // expected-error {{variable of type 'Foo' has private destructor}}
+}
+@end
OpenPOWER on IntegriCloud