have LLVM print type strings for us

Example:

    void ({ i64, %tydesc*, i8*, i8*, i8 }*, i64*, %"struct.std::fmt::Formatter[#1]"*)*

Before, we would print 20 levels deep due to recursion in the type
definition.
This commit is contained in:
Daniel Micay 2013-10-11 19:56:11 -04:00
parent 80878ff369
commit 7bad416765
3 changed files with 17 additions and 60 deletions

View file

@ -803,3 +803,10 @@ extern "C" void LLVMDICompositeTypeSetTypeArray(
{
unwrapDI<DICompositeType>(CompositeType).setTypeArray(unwrapDI<DIArray>(TypeArray));
}
extern "C" char *LLVMTypeToString(LLVMTypeRef Type) {
std::string s;
llvm::raw_string_ostream os(s);
unwrap<llvm::Type>(Type)->print(os);
return strdup(os.str().data());
}