1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

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

llvm-svn: 28536
This commit is contained in:
Reid Spencer 2006-05-29 02:58:15 +00:00
parent 2bd5cd1602
commit 631bd45185
2 changed files with 17 additions and 4 deletions

View File

@ -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";
}

View File

@ -13,11 +13,16 @@ USEDLIBS = LLVMAsmParser LLVMBCWriter LLVMCore \
include $(LEVEL)/Makefile.common
tryit: all-local recurty.cpp globalvars.cpp
CPPFILESTOTRY = recurty.cpp globalvars.cpp
tryit: all-local $(CPPFILESTOTRY)
%.cpp : %.ll
%.cpp : %.ll $(ToolDir)/llvm2cpp
llvm2cpp $*.ll -f -o $*.cpp
gcc -I$(LLVM_SRC_ROOT)/include -I$(LLVM_OBJ_ROOT)/include -g \
% : %.cpp Makefile
gcc -Wall -I$(LLVM_SRC_ROOT)/include -I$(LLVM_OBJ_ROOT)/include -g \
-D__STDC_LIMIT_MACROS -L$(LibDir) $(LibDir)/LLVMCore.o -lLLVMSupport \
$(LibDir)/LLVMbzip2.o -lLLVMSystem -lstdc++ \
$(LibDir)/LLVMbzip2.o -lLLVMSystem -lstdc++ -Wno-unused \
$*.cpp -o $*
#$(CPPFILESTOTRY): $(ToolDir)/llvm2cpp