[cfe-commits] r114223 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/method-bad-param.m
Fariborz Jahanian
fjahanian at apple.com
Fri Sep 17 15:07:07 PDT 2010
Author: fjahanian
Date: Fri Sep 17 17:07:07 2010
New Revision: 114223
URL: http://llvm.org/viewvc/llvm-project?rev=114223&view=rev
Log:
Diagnose use of incomplete type on method argument type of
method definitions instead of crashing in code gen.
Fixes radar 8421082.
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/test/SemaObjC/method-bad-param.m
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=114223&r1=114222&r2=114223&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Sep 17 17:07:07 2010
@@ -55,9 +55,15 @@
// Introduce all of the other parameters into this scope.
for (ObjCMethodDecl::param_iterator PI = MDecl->param_begin(),
- E = MDecl->param_end(); PI != E; ++PI)
+ 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 ((*PI)->getIdentifier())
PushOnScopeChains(*PI, FnBodyScope);
+ }
}
Decl *Sema::
Modified: cfe/trunk/test/SemaObjC/method-bad-param.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/method-bad-param.m?rev=114223&r1=114222&r2=114223&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/method-bad-param.m (original)
+++ cfe/trunk/test/SemaObjC/method-bad-param.m Fri Sep 17 17:07:07 2010
@@ -28,3 +28,17 @@
extern void g0(int x, ...);
g0(1, *(foo*)0); // expected-error {{cannot pass object with interface type 'foo' by-value through variadic function}}
}
+
+// rdar://8421082
+enum bogus; // expected-note {{forward declaration of 'enum bogus'}}
+
+ at interface fee {
+}
+- (void)crashMe:(enum bogus)p;
+ at end
+
+ at implementation fee
+- (void)crashMe:(enum bogus)p { // expected-error {{variable has incomplete type 'enum bogus'}}
+}
+ at end
+
More information about the cfe-commits
mailing list