about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2014-01-15 14:39:08 -0500
committerNiko Matsakis <niko@alum.mit.edu>2014-01-15 18:34:38 -0500
commit419ac4a1b899ba88fb360b4c71c08f3610564cd4 (patch)
treea67114bd33e84818930d054f29ac81b726a88198 /src/rustllvm/RustWrapper.cpp
parent149fc76698318f8f7cdfaa37a818e347721764e7 (diff)
downloadrust-419ac4a1b899ba88fb360b4c71c08f3610564cd4.tar.gz
rust-419ac4a1b899ba88fb360b4c71c08f3610564cd4.zip
Issue #3511 - Rationalize temporary lifetimes.
Major changes:

- Define temporary scopes in a syntax-based way that basically defaults
  to the innermost statement or conditional block, except for in
  a `let` initializer, where we default to the innermost block. Rules
  are documented in the code, but not in the manual (yet).
  See new test run-pass/cleanup-value-scopes.rs for examples.
- Refactors Datum to better define cleanup roles.
- Refactor cleanup scopes to not be tied to basic blocks, permitting
  us to have a very large number of scopes (one per AST node).
- Introduce nascent documentation in trans/doc.rs covering datums and
  cleanup in a more comprehensive way.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
-rw-r--r--src/rustllvm/RustWrapper.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index 1fb05b89381..280df8cb10f 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -522,6 +522,17 @@ extern "C" char *LLVMTypeToString(LLVMTypeRef Type) {
     return strdup(os.str().data());
 }
 
+extern "C" char *LLVMValueToString(LLVMValueRef Value) {
+    std::string s;
+    llvm::raw_string_ostream os(s);
+    os << "(";
+    unwrap<llvm::Value>(Value)->getType()->print(os);
+    os << ":";
+    unwrap<llvm::Value>(Value)->print(os);
+    os << ")";
+    return strdup(os.str().data());
+}
+
 extern "C" bool
 LLVMRustLinkInExternalBitcode(LLVMModuleRef dst, char *bc, size_t len) {
     Module *Dst = unwrap(dst);