[cfe-dev] cleanup attribute argument checking

Jean-Daniel Dupas devlists at shadowlab.org
Tue Feb 24 09:39:01 PST 2009


Hello,

There is currently this comment in SemaDeclAttr.cpp concerning the  
'cleanup' attribute argument type checking:

   // We're currently more strict than GCC about what function types  
we accept.
   // If this ever proves to be a problem it should be easy to fix.
   QualType Ty = S.Context.getPointerType(VD->getType());
   QualType ParamTy = FD->getParamDecl(0)->getType();
   if (Ty != ParamTy) {
     S.Diag(Attr.getLoc(),
            diag::err_attribute_cleanup_func_arg_incompatible_type) <<
       Attr.getParameterName() << ParamTy << Ty;
     return;
   }

It is a problem with objc as declaring a cleanup fonction that take an  
(id *) will force all variables that use this function to be strictly  
typed as  'id'.  (see bug #3656)

error: 'cleanup' function '$wb_scopeReleaseObject' parameter has type  
'id *', expected type 'NSString **'

What could be done to workaround this issue ? It prevent compilation  
of file that gcc compile fine, and it prevent me to test clang with  
some objc projects :-(


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090224/9731e085/attachment.html>


More information about the cfe-dev mailing list