From d448c1ba043ad41435001057885bacfd91371e9e Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Wed, 23 Jun 2010 18:58:10 +0000 Subject: [PATCH] Fixes for array handling and dynamic type casting errors pointed out by John McCall. llvm-svn: 106665 --- lldb/source/Expression/ClangASTSource.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp index 3c18b70b6d47..4f8ef0fa6e0a 100644 --- a/lldb/source/Expression/ClangASTSource.cpp +++ b/lldb/source/Expression/ClangASTSource.cpp @@ -112,15 +112,14 @@ clang::NamedDecl *NameSearchContext::AddFunDecl(void *type) { QualType QT = QualType::getFromOpaquePtr(type); clang::Type *T = QT.getTypePtr(); + const FunctionProtoType *FPT = T->getAs(); - if (T->isFunctionProtoType()) - { - FunctionProtoType *FPT = dyn_cast(T); - + if (FPT) + { unsigned NumArgs = FPT->getNumArgs(); unsigned ArgIndex; - ParmVarDecl *ParmVarDecls[NumArgs]; + ParmVarDecl **ParmVarDecls = new ParmVarDecl*[NumArgs]; for (ArgIndex = 0; ArgIndex < NumArgs; ++ArgIndex) { @@ -138,6 +137,8 @@ clang::NamedDecl *NameSearchContext::AddFunDecl(void *type) { } Decl->setParams(ParmVarDecls, NumArgs); + + delete [] ParmVarDecls; } Decls.push_back(Decl);