diff options
author | Steve Naroff <snaroff@apple.com> | 2009-04-14 00:03:58 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-04-14 00:03:58 +0000 |
commit | e4e55d2706a5736e251ec89b1eb68081c18263bb (patch) | |
tree | 3a5cda2bbb9abec3af0627be079178962e5e31e5 /clang | |
parent | a541485bab30b83b630b8898c39a17eb571507ae (diff) | |
download | bcm5719-llvm-e4e55d2706a5736e251ec89b1eb68081c18263bb.tar.gz bcm5719-llvm-e4e55d2706a5736e251ec89b1eb68081c18263bb.zip |
Fix crasher in ASTContext::getObjCEncodingForMethodDecl().
This was exposed as a result of something else that was recently fixed.
llvm-svn: 69004
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 12 | ||||
-rw-r--r-- | clang/test/CodeGen/function-decay.m | 10 |
2 files changed, 17 insertions, 5 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index f319c3f392e..1c682175b33 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -2081,11 +2081,13 @@ void ASTContext::getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, ParmVarDecl *PVDecl = *PI; QualType PType = PVDecl->getOriginalType(); if (const ArrayType *AT = - dyn_cast<ArrayType>(PType->getCanonicalTypeInternal())) - // Use array's original type only if it has known number of - // elements. - if (!dyn_cast<ConstantArrayType>(AT)) - PType = PVDecl->getType(); + dyn_cast<ArrayType>(PType->getCanonicalTypeInternal())) { + // Use array's original type only if it has known number of + // elements. + if (!dyn_cast<ConstantArrayType>(AT)) + PType = PVDecl->getType(); + } else if (PType->isFunctionType()) + PType = PVDecl->getType(); // Process argument qualifiers for user supplied arguments; such as, // 'in', 'inout', etc. getObjCEncodingForTypeQualifier(PVDecl->getObjCDeclQualifier(), S); diff --git a/clang/test/CodeGen/function-decay.m b/clang/test/CodeGen/function-decay.m new file mode 100644 index 00000000000..9c871139dba --- /dev/null +++ b/clang/test/CodeGen/function-decay.m @@ -0,0 +1,10 @@ +// RUN: clang-cc %s -emit-llvm + +@interface I0 @end +@implementation I0 +- (void) im0: (int (void)) a0 { +} +@end + +void func(int pf(void)) { +} |