Fixes for array handling and dynamic type casting

errors pointed out by John McCall.

llvm-svn: 106665
This commit is contained in:
Sean Callanan 2010-06-23 18:58:10 +00:00
parent fc40f0a1ab
commit d448c1ba04
1 changed files with 6 additions and 5 deletions

View File

@ -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<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 @@ clang::NamedDecl *NameSearchContext::AddFunDecl(void *type) {
}
Decl->setParams(ParmVarDecls, NumArgs);
delete [] ParmVarDecls;
}
Decls.push_back(Decl);