[cfe-commits] r60781 - /cfe/trunk/lib/Sema/SemaDeclObjC.cpp

Fariborz Jahanian fjahanian at apple.com
Tue Dec 9 12:24:47 PST 2008


Please provide a test case where possible.

- Fariborz

On Dec 9, 2008, at 11:36 AM, Steve Naroff wrote:

> Author: snaroff
> Date: Tue Dec  9 13:36:17 2008
> New Revision: 60781
>
> URL: http://llvm.org/viewvc/llvm-project?rev=60781&view=rev
> Log:
> Sema::ActOnMethodDeclaration(): Make sure we perform the default  
> function/array conversion for parameter types.
>
> This fixes <rdar://problem/6424064> checker on xcode: (possible bad  
> AST) can the type of a method parameter really have  
> "isFunctionType() == true"?
> and http://llvm.org/bugs/show_bug.cgi?id=2997.
>
> Modified:
>    cfe/trunk/lib/Sema/SemaDeclObjC.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=60781&r1=60780&r2=60781&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Tue Dec  9 13:36:17 2008
> @@ -1227,9 +1227,14 @@
>     // FIXME: arg->AttrList must be stored too!
>     QualType argType;
>
> -    if (ArgTypes[i])
> +    if (ArgTypes[i]) {
>       argType = QualType::getFromOpaquePtr(ArgTypes[i]);
> -    else
> +      // Perform the default array/function conversions (C99  
> 6.7.5.3p[7,8]).
> +      if (argType->isArrayType()) // (char *[]) -> (char **)
> +        argType = Context.getArrayDecayedType(argType);
> +      else if (argType->isFunctionType())
> +        argType = Context.getPointerType(argType);
> +    } else
>       argType = Context.getObjCIdType();
>     ParmVarDecl* Param = ParmVarDecl::Create(Context, ObjCMethod,
>                                              SourceLocation(/ 
> *FIXME*/),
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list