aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-12-03 19:55:17 -0500
committerAlon Zakai <alonzakai@gmail.com>2013-12-03 19:55:17 -0500
commit2f30cc800b06f8ef17b3e7cfec7b53bb56b4710d (patch)
tree0f6c34cff28c45b4531bd3d0028c419a4193a2a3
parentd6f9c26b7ab0ac8e6252d0214ecbc07e9c6c57ac (diff)
use function types for signature generation
-rw-r--r--lib/Target/CppBackend/CPPBackend.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp
index 2433a36ad5..eee89ed9d1 100644
--- a/lib/Target/CppBackend/CPPBackend.cpp
+++ b/lib/Target/CppBackend/CPPBackend.cpp
@@ -238,19 +238,19 @@ namespace {
else if (T->isFloatTy() || T->isDoubleTy()) return 'd'; // TODO: float
else return 'i';
}
- std::string getFunctionSignature(const Function *F) {
+ std::string getFunctionSignature(const FunctionType *F) {
std::string Ret;
Ret += getFunctionSignatureLetter(F->getReturnType());
- for (Function::const_arg_iterator AI = F->arg_begin(),
- AE = F->arg_end(); AI != AE; ++AI) {
- Ret += getFunctionSignatureLetter(AI->getType());
+ for (FunctionType::param_iterator AI = F->param_begin(),
+ AE = F->param_end(); AI != AE; ++AI) {
+ Ret += getFunctionSignatureLetter(*AI);
}
return Ret;
}
unsigned getFunctionIndex(const Function *F) {
std::string Name = getCppName(F);
if (IndexedFunctions.find(Name) != IndexedFunctions.end()) return IndexedFunctions[Name];
- std::string Sig = getFunctionSignature(F);
+ std::string Sig = getFunctionSignature(F->getFunctionType());
FunctionTable &Table = FunctionTables[Sig];
while (Table.size() == 0 || Table.size() % 2 == 1) Table.push_back("0"); // TODO: optimize this, fill in holes, see test_polymorph
unsigned Index = Table.size();