Fix crasher in ASTContext::getObjCEncodingForMethodDecl().
This was exposed as a result of something else that was recently fixed.
llvm-svn: 69004
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index f319c3f..1c68217 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -2081,11 +2081,13 @@
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);