about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-10-11 19:21:16 -0700
committerbors <bors@rust-lang.org>2013-10-11 19:21:16 -0700
commit35a944a48806356e816a68ee3758f7b2f4244fca (patch)
tree26ae480457bf2d9a7100561e705f39942d98116d /src/rustllvm/RustWrapper.cpp
parent399a42575a3a5392277e4034812ce32c4f491929 (diff)
parent7bad4167654ef846155bae7165fd0ffcc24fcbbe (diff)
downloadrust-35a944a48806356e816a68ee3758f7b2f4244fca.tar.gz
rust-35a944a48806356e816a68ee3758f7b2f4244fca.zip
auto merge of #9815 : thestinger/rust/type, r=huonw
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.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
-rw-r--r--src/rustllvm/RustWrapper.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index 31a02dceb1c..f8d56f4e892 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -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());
+}