From 17b7148300a9043e9511b32fcf1f4f9f4488fbca Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Fri, 13 Apr 2012 19:50:45 -0700 Subject: [PATCH] Initial implementation of FunctionType::GetDIType --- type.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/type.cpp b/type.cpp index 3795a3dc..e1372902 100644 --- a/type.cpp +++ b/type.cpp @@ -2535,9 +2535,22 @@ FunctionType::LLVMType(llvm::LLVMContext *ctx) const { llvm::DIType FunctionType::GetDIType(llvm::DIDescriptor scope) const { - // @todo need to implement FunctionType::GetDIType() - FATAL("need to implement FunctionType::GetDIType()"); - return llvm::DIType(); + std::vector retArgTypes; + + retArgTypes.push_back(returnType->GetDIType(scope)); + for (int i = 0; i < GetNumParameters(); ++i) { + const Type *t = GetParameterType(i); + if (t == NULL) + return llvm::DIType(); + retArgTypes.push_back(t->GetDIType(scope)); + } + + llvm::DIArray retArgTypesArray = + m->diBuilder->getOrCreateArray(llvm::ArrayRef(retArgTypes)); + llvm::DIType diType = + // FIXME: DIFile + m->diBuilder->createSubroutineType(llvm::DIFile(), retArgTypesArray); + return diType; }