Getting A Type By Name

What's the RightWay(tm) to get a named type?

I want to use the Module's symbol table as a repository for named types.
But, it doesn't have a way to get the type out unless you already know
what it is (i.e. the addTypeName() method). Similarly the SymbolTable
class's lookup() method requires a type as well. The Type class also
didn't have anything obvious.

I want something like:

Type* Module::getNamedType( std::string& name );

which returns the type if found or null if not found.

This is too simple to not be implemented so I figured I'm looking in the
wrong places.

Enlighten me, please?

Reid.

What's the RightWay(tm) to get a named type? I want to use the Module's
symbol table as a repository for named types. But, it doesn't have a way
to get the type out unless you already know what it is (i.e. the
addTypeName() method). Similarly the SymbolTable class's lookup() method
requires a type as well. The Type class also didn't have anything
obvious.

Yup, currently you have to directly access the Module's symbol table.
Types have class 'Type::TypeTy', so you would do something like this:

Type *Module::getNamedType(const std::string &name) {
  SymbolTable &SymTab = getSymbolTable();
  return cast_or_null<Type>(SymTab.lookup(Type::TypeTy, name));
}

which returns the type if found or null if not found.

This is too simple to not be implemented so I figured I'm looking in the
wrong places.

Heh, well it's so simple, it's not yet implemented :). I'll add this
though.

-Chris