From 5584240c7feba50effedf1a507f3c188f583bb14 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Fri, 23 Sep 2011 15:05:59 -0700 Subject: [PATCH] Fix crash with function declarations with unnamed parameters. Fixes issue #103. Previously, we were inadvertently grabbing the function's return type for the parameter, rather than the actual parameter type. --- decl.cpp | 2 +- type.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/decl.cpp b/decl.cpp index fd14cfb6..82a59e3d 100644 --- a/decl.cpp +++ b/decl.cpp @@ -237,7 +237,7 @@ Declarator::GetType(DeclSpecs *ds) const { sprintf(buf, "__anon_parameter_%d", i); sym = new Symbol(buf, pos); Declarator *declarator = new Declarator(sym, sym->pos); - sym->type = declarator->GetType(ds); + sym->type = declarator->GetType(d->declSpecs); d->declarators.push_back(declarator); } else { diff --git a/type.cpp b/type.cpp index 4e61d156..69e6646c 100644 --- a/type.cpp +++ b/type.cpp @@ -1833,6 +1833,7 @@ FunctionType::LLVMFunctionType(llvm::LLVMContext *ctx, bool includeMask) const { for (unsigned int i = 0; i < argTypes.size(); ++i) { if (!argTypes[i]) return NULL; + assert(argTypes[i] != AtomicType::Void); LLVM_TYPE_CONST llvm::Type *t = argTypes[i]->LLVMType(ctx); if (!t)