Changes in directory llvm/tools/llvm2cpp:

CppWriter.cpp updated: 1.1 -> 1.2
Makefile updated: 1.1 -> 1.2
---
Log message:

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


---
Diffs of the changes:  (+17 -4)

 CppWriter.cpp |    8 ++++++++
 Makefile      |   13 +++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)


Index: llvm/tools/llvm2cpp/CppWriter.cpp
diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.1 
llvm/tools/llvm2cpp/CppWriter.cpp:1.2
--- llvm/tools/llvm2cpp/CppWriter.cpp:1.1       Sun May 28 19:57:22 2006
+++ llvm/tools/llvm2cpp/CppWriter.cpp   Sun May 28 21:58:15 2006
@@ -1120,6 +1120,13 @@
       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 @@
   SlotMachine SlotTable(mod);
   CppWriter W(o, SlotTable, mod);
   W.write(mod);
+  o << "return mod;\n";
   o << "}\n";
 }
 


Index: llvm/tools/llvm2cpp/Makefile
diff -u llvm/tools/llvm2cpp/Makefile:1.1 llvm/tools/llvm2cpp/Makefile:1.2
--- llvm/tools/llvm2cpp/Makefile:1.1    Sun May 28 19:57:22 2006
+++ llvm/tools/llvm2cpp/Makefile        Sun May 28 21:58:15 2006
@@ -13,11 +13,16 @@
 
 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



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to