diff options
| author | Steve Naroff <snaroff@apple.com> | 2008-12-09 19:36:17 +0000 | 
|---|---|---|
| committer | Steve Naroff <snaroff@apple.com> | 2008-12-09 19:36:17 +0000 | 
| commit | b0498eebc21d152af34ed0acda730a5c74f962a7 (patch) | |
| tree | 78b95e95813a797f17db56e5ae681e7be11a5549 /clang/lib/Sema/SemaDeclObjC.cpp | |
| parent | b6fc4b8d9209868060bed65f890e84d23297bb83 (diff) | |
| download | bcm5719-llvm-b0498eebc21d152af34ed0acda730a5c74f962a7.tar.gz bcm5719-llvm-b0498eebc21d152af34ed0acda730a5c74f962a7.zip | |
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.
llvm-svn: 60781
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 9 | 
1 files changed, 7 insertions, 2 deletions
| diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 5e9e2b21e2d..308c125d9ae 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -1227,9 +1227,14 @@ Sema::DeclTy *Sema::ActOnMethodDeclaration(      // 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*/), | 

