]> granicus.if.org Git - clang/commitdiff
Diagnose C++ abstract parameters for Objective-C methods.
authorJohn McCall <rjmccall@apple.com>
Sat, 23 Apr 2011 02:46:06 +0000 (02:46 +0000)
committerJohn McCall <rjmccall@apple.com>
Sat, 23 Apr 2011 02:46:06 +0000 (02:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130045 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclObjC.cpp
test/SemaObjCXX/parameters.mm

index 01d37f47b2c1e5ef1f3e8600fc54f3eae6684abd..7429020126c0d1fdffc08ce7788ac4942200c1e3 100644 (file)
@@ -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()));
index aab1fbda4dd8b4c3a6f78eef01f0399bbcdfdb30..1a7869dc7a7a335541130ac43c06d2e4c7ba717a 100644 (file)
@@ -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