summaryrefslogtreecommitdiffstats
path: root/clang/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-06-09 02:28:57 +0000
committerChris Lattner <sabre@nondot.org>2007-06-09 02:28:57 +0000
commit45bb914249936adaf1951bf92cf7105a5529a2a9 (patch)
treeb27ed9dacc79b9dee94af744cabeb2cc5e309ad9 /clang/CodeGen/CodeGenFunction.cpp
parent1ad38f8feee93b22e69aa3543a6027445500c521 (diff)
downloadbcm5719-llvm-45bb914249936adaf1951bf92cf7105a5529a2a9.tar.gz
bcm5719-llvm-45bb914249936adaf1951bf92cf7105a5529a2a9.zip
Convert argument types over, which works for trivial scalars.
llvm-svn: 39625
Diffstat (limited to 'clang/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/CodeGen/CodeGenFunction.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/clang/CodeGen/CodeGenFunction.cpp b/clang/CodeGen/CodeGenFunction.cpp
index 817c5fca74e..bb7a05717ad 100644
--- a/clang/CodeGen/CodeGenFunction.cpp
+++ b/clang/CodeGen/CodeGenFunction.cpp
@@ -121,11 +121,16 @@ const llvm::Type *CodeGenFunction::ConvertType(QualType T, SourceLocation Loc) {
ResultType = ConvertType(FP.getResultType(), Loc);
// FIXME: Convert argument types.
+ bool isVarArg;
+ std::vector<const llvm::Type*> ArgTys;
+ if (const FunctionTypeProto *FTP = dyn_cast<FunctionTypeProto>(&FP)) {
+ DecodeArgumentTypes(*FTP, ArgTys, Loc);
+ isVarArg = FTP->isVariadic();
+ } else {
+ isVarArg = true;
+ }
- return llvm::FunctionType::get(ResultType,
- std::vector<const llvm::Type*>(),
- false,
- 0);
+ return llvm::FunctionType::get(ResultType, ArgTys, isVarArg, 0);
}
case Type::TypeName:
case Type::Tagged:
@@ -136,6 +141,12 @@ const llvm::Type *CodeGenFunction::ConvertType(QualType T, SourceLocation Loc) {
return OpaqueType::get();
}
+void CodeGenFunction::DecodeArgumentTypes(const FunctionTypeProto &FTP,
+ std::vector<const llvm::Type*> &
+ ArgTys, SourceLocation Loc) {
+ for (unsigned i = 0, e = FTP.getNumArgs(); i != e; ++i)
+ ArgTys.push_back(ConvertType(FTP.getArgType(i), Loc));
+}
void CodeGenFunction::GenerateCode(const FunctionDecl *FD) {
LLVMIntTy = ConvertType(getContext().IntTy, FD->getLocation());
OpenPOWER on IntegriCloud