Fixes for array handling and dynamic type casting
errors pointed out by John McCall.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106665 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangASTSource.cpp b/source/Expression/ClangASTSource.cpp
index 3c18b70..4f8ef0f 100644
--- a/source/Expression/ClangASTSource.cpp
+++ b/source/Expression/ClangASTSource.cpp
@@ -112,15 +112,14 @@
QualType QT = QualType::getFromOpaquePtr(type);
clang::Type *T = QT.getTypePtr();
+ const FunctionProtoType *FPT = T->getAs<FunctionProtoType>();
- if (T->isFunctionProtoType())
- {
- FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(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 @@
}
Decl->setParams(ParmVarDecls, NumArgs);
+
+ delete [] ParmVarDecls;
}
Decls.push_back(Decl);