aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-04-23 02:46:06 +0000
committerJohn McCall <rjmccall@apple.com>2011-04-23 02:46:06 +0000
commit81ef3e664d8ae250fbb68b2b6ccdeebb6c13ede5 (patch)
tree7319bf4d8c93f4146addeb3f7f32cb3192b542da
parente5e3d31dab0de2dcbf8da94177da74fe95509d2a (diff)
Diagnose C++ abstract parameters for Objective-C methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130045 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDeclObjC.cpp14
-rw-r--r--test/SemaObjCXX/parameters.mm5
2 files changed, 8 insertions, 11 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 01d37f47b2..7429020126 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -1803,17 +1803,9 @@ Decl *Sema::ActOnMethodDeclaration(
? DI->getTypeLoc().getBeginLoc()
: ArgInfo[i].NameLoc;
- ParmVarDecl* Param
- = ParmVarDecl::Create(Context, ObjCMethod,
- StartLoc, ArgInfo[i].NameLoc, ArgInfo[i].Name,
- ArgType, DI, SC_None, SC_None, 0);
-
- if (ArgType->isObjCObjectType()) {
- Diag(ArgInfo[i].NameLoc,
- diag::err_object_cannot_be_passed_returned_by_value)
- << 1 << ArgType;
- Param->setInvalidDecl();
- }
+ ParmVarDecl* Param = CheckParameter(ObjCMethod, StartLoc,
+ ArgInfo[i].NameLoc, ArgInfo[i].Name,
+ ArgType, DI, SC_None, SC_None);
Param->setObjCDeclQualifier(
CvtQTToAstBitMask(ArgInfo[i].DeclSpec.getObjCDeclQualifier()));
diff --git a/test/SemaObjCXX/parameters.mm b/test/SemaObjCXX/parameters.mm
index aab1fbda4d..1a7869dc7a 100644
--- a/test/SemaObjCXX/parameters.mm
+++ b/test/SemaObjCXX/parameters.mm
@@ -10,3 +10,8 @@ struct X0 {
X0<A> x0a; // expected-note{{instantiation}}
+
+struct test2 { virtual void foo() = 0; }; // expected-note {{unimplemented}}
+@interface Test2
+- (void) foo: (test2) foo; // expected-error {{parameter type 'test2' is an abstract class}}
+@end