From 74e032a4d4673f53388571ab9ecd783584e3fccf Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Mon, 29 May 2006 02:58:15 +0000 Subject: Fix two bugs in the CppWriter.cpp: 1. Return the module from the MakeModule function so it can be verified. 2. Make sure types get generated with their names git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28536 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm2cpp/CppWriter.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tools/llvm2cpp/CppWriter.cpp') diff --git a/tools/llvm2cpp/CppWriter.cpp b/tools/llvm2cpp/CppWriter.cpp index 54a28e9f83..0f28e30e16 100644 --- a/tools/llvm2cpp/CppWriter.cpp +++ b/tools/llvm2cpp/CppWriter.cpp @@ -1120,6 +1120,13 @@ CppWriter::printTypeDefInternal(const Type* Ty) { assert(!"Invalid TypeID"); } + // If the type had a name, make sure we recreate it. + const std::string* progTypeName = + findTypeName(TheModule->getSymbolTable(),Ty); + if (progTypeName) + Out << "mod->addTypeName(\"" << *progTypeName << "\", " + << typeName << ");\n"; + // Pop us off the type stack TypeStack.pop_back(); @@ -1989,6 +1996,7 @@ void WriteModuleToCppFile(Module* mod, std::ostream& o) { SlotMachine SlotTable(mod); CppWriter W(o, SlotTable, mod); W.write(mod); + o << "return mod;\n"; o << "}\n"; } -- cgit v1.2.3