diff options
| author | bors <bors@rust-lang.org> | 2013-09-04 11:55:52 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-04 11:55:52 -0700 |
| commit | 45c3ca72bc19230f82775eb4228f1b3f178baade (patch) | |
| tree | a2641a829e3ef6e0791425bcfa98199aafb8946c /src/rustllvm/RustWrapper.cpp | |
| parent | d1f90556f20fb5508c4e859da7abf667a00967b4 (diff) | |
| parent | 5b94ae93f3d00f5afe3f1d957aad76173ed7e705 (diff) | |
| download | rust-45c3ca72bc19230f82775eb4228f1b3f178baade.tar.gz rust-45c3ca72bc19230f82775eb4228f1b3f178baade.zip | |
auto merge of #8855 : michaelwoerister/rust/captured_vars, r=jdm
This pull request includes * support for variables captured in closures*, * a fix for issue #8512: arguments of non-immediate type (structs, tuples, etc) passed by value can now be accessed correctly in GDB. (I managed to fix this by using `llvm::DIBuilder::createComplexVariable()`. ~~However, I am not sure if this relies on unstable implementation details of LLVM's debug info handling. I'll try to clarify this on the LLVM mailing list~~). * simplification of the `debuginfo` module's public interface: the caller of functions like `create_local_var_metadata()` doesn't have to know and catch all cases when it mustn't call the function, * a cleanup refactoring with unified handling for locals, [self] arguments, captured variables, and match bindings, * and proper span information for self arguments. \* However, see comment at https://github.com/michaelwoerister/rust/blob/1d916ace136a27e354d73d65f488603c65f65bd2/src/test/debug-info/var-captured-in-nested-closure.rs#L62 . This is the same problem as with the fix for issue #8512 above: We are probably using `llvm.dbg.declare` in an unsupported way that works today but might not work after the next LLVM update. Cheers, Michael Fixes #8512 Fixes #1341
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
| -rw-r--r-- | src/rustllvm/RustWrapper.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 54af6fe7e73..376adf24e25 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -724,3 +724,39 @@ extern "C" LLVMValueRef LLVMDIBuilderCreateTemplateTypeParameter( LineNo, ColumnNo)); } + +extern "C" LLVMValueRef LLVMDIBuilderCreateOpDeref(LLVMTypeRef IntTy) +{ + return LLVMConstInt(IntTy, DIBuilder::OpDeref, true); +} + +extern "C" LLVMValueRef LLVMDIBuilderCreateOpPlus(LLVMTypeRef IntTy) +{ + return LLVMConstInt(IntTy, DIBuilder::OpPlus, true); +} + +extern "C" LLVMValueRef LLVMDIBuilderCreateComplexVariable( + DIBuilderRef Builder, + unsigned Tag, + LLVMValueRef Scope, + const char *Name, + LLVMValueRef File, + unsigned LineNo, + LLVMValueRef Ty, + LLVMValueRef* AddrOps, + unsigned AddrOpsCount, + unsigned ArgNo) +{ + llvm::ArrayRef<llvm::Value*> addr_ops((llvm::Value**)AddrOps, AddrOpsCount); + + return wrap(Builder->createComplexVariable( + Tag, + unwrapDI<DIDescriptor>(Scope), + Name, + unwrapDI<DIFile>(File), + LineNo, + unwrapDI<DIType>(Ty), + addr_ops, + ArgNo + )); +} |
