diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-11-25 18:29:21 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-11-25 18:29:21 -0800 |
commit | bf46f0754257ba134e50ea13a7515a8d08ceeaec (patch) | |
tree | 3b66da66fed29ed0a109e75556219bfa7ce2058e /lib/Target/CppBackend/CPPBackend.cpp | |
parent | 391208c542a4fb68ed1767531d3a290b53bb9721 (diff) |
handle ptrtoint of functions
Diffstat (limited to 'lib/Target/CppBackend/CPPBackend.cpp')
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 68c29ebf06..7954fc4dc3 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -202,7 +202,7 @@ namespace { Address a = GlobalAddresses[s]; return a.first; } - unsigned getConstAsOffset(Value *V) { + unsigned getConstAsOffset(const Value *V) { if (isa<Function>(V)) { dump("TODO: function indexing"); return 0; @@ -1667,7 +1667,7 @@ std::string CppWriter::generateInstruction(const Instruction *I) { case Instruction::PtrToInt: text = getAssign(iName, Type::getInt32Ty(I->getContext())); if (const Constant *CV = dyn_cast<Constant>(I->getOperand(0))) { - text += utostr(getGlobalAddress(CV->getName().str())); + text += utostr(getConstAsOffset(CV)); } else { text += getCast(getValueAsStr(I->getOperand(0)), Type::getInt32Ty(I->getContext())); } |