From 419ac4a1b899ba88fb360b4c71c08f3610564cd4 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 15 Jan 2014 14:39:08 -0500 Subject: 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. --- src/rustllvm/RustWrapper.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/rustllvm/RustWrapper.cpp') 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(Value)->getType()->print(os); + os << ":"; + unwrap(Value)->print(os); + os << ")"; + return strdup(os.str().data()); +} + extern "C" bool LLVMRustLinkInExternalBitcode(LLVMModuleRef dst, char *bc, size_t len) { Module *Dst = unwrap(dst); -- cgit 1.4.1-3-g733a5