summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm2cpp/CppWriter.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-01-06 07:24:44 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-01-06 07:24:44 +0000
commit32af9e8cc54eb85340c1ff1b46e0d5a3afc3db4a (patch)
tree6427b085ec992c547b266323673e0c83b4c6770a /llvm/tools/llvm2cpp/CppWriter.cpp
parentebbbbf62736651d6fc5640cfa5574da28568efc5 (diff)
downloadbcm5719-llvm-32af9e8cc54eb85340c1ff1b46e0d5a3afc3db4a.tar.gz
bcm5719-llvm-32af9e8cc54eb85340c1ff1b46e0d5a3afc3db4a.zip
For PR411:
Take an incremental step towards type plane elimination. This change separates types from values in the symbol tables by finally making use of the TypeSymbolTable class. This yields more natural interfaces for dealing with types and unclutters the SymbolTable class. llvm-svn: 32956
Diffstat (limited to 'llvm/tools/llvm2cpp/CppWriter.cpp')
-rw-r--r--llvm/tools/llvm2cpp/CppWriter.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/tools/llvm2cpp/CppWriter.cpp b/llvm/tools/llvm2cpp/CppWriter.cpp
index d2d2d849f5f..b0eb1209e77 100644
--- a/llvm/tools/llvm2cpp/CppWriter.cpp
+++ b/llvm/tools/llvm2cpp/CppWriter.cpp
@@ -20,6 +20,7 @@
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/SymbolTable.h"
+#include "llvm/TypeSymbolTable.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/CommandLine.h"
@@ -189,10 +190,10 @@ getTypePrefix(const Type* Ty ) {
// Mode::getTypeName function which will return an empty string, not a null
// pointer if the name is not found.
inline const std::string*
-findTypeName(const SymbolTable& ST, const Type* Ty)
+findTypeName(const TypeSymbolTable& ST, const Type* Ty)
{
- SymbolTable::type_const_iterator TI = ST.type_begin();
- SymbolTable::type_const_iterator TE = ST.type_end();
+ TypeSymbolTable::const_iterator TI = ST.begin();
+ TypeSymbolTable::const_iterator TE = ST.end();
for (;TI != TE; ++TI)
if (TI->second == Ty)
return &(TI->first);
@@ -348,7 +349,7 @@ CppWriter::getCppName(const Type* Ty)
}
// See if the type has a name in the symboltable and build accordingly
- const std::string* tName = findTypeName(TheModule->getSymbolTable(), Ty);
+ const std::string* tName = findTypeName(TheModule->getTypeSymbolTable(), Ty);
std::string name;
if (tName)
name = std::string(prefix) + *tName;
@@ -539,7 +540,7 @@ CppWriter::printTypeInternal(const Type* Ty) {
// If the type had a name, make sure we recreate it.
const std::string* progTypeName =
- findTypeName(TheModule->getSymbolTable(),Ty);
+ findTypeName(TheModule->getTypeSymbolTable(),Ty);
if (progTypeName)
Out << "mod->addTypeName(\"" << *progTypeName << "\", "
<< typeName << ");";
@@ -596,9 +597,9 @@ void
CppWriter::printTypes(const Module* M) {
// Walk the symbol table and print out all its types
- const SymbolTable& symtab = M->getSymbolTable();
- for (SymbolTable::type_const_iterator TI = symtab.type_begin(),
- TE = symtab.type_end(); TI != TE; ++TI) {
+ const TypeSymbolTable& symtab = M->getTypeSymbolTable();
+ for (TypeSymbolTable::const_iterator TI = symtab.begin(), TE = symtab.end();
+ TI != TE; ++TI) {
// For primitive types and types already defined, just add a name
TypeMap::const_iterator TNI = TypeNames.find(TI->second);
OpenPOWER on IntegriCloud