about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-09-04 11:55:52 -0700
committerbors <bors@rust-lang.org>2013-09-04 11:55:52 -0700
commit45c3ca72bc19230f82775eb4228f1b3f178baade (patch)
treea2641a829e3ef6e0791425bcfa98199aafb8946c /src/libsyntax
parentd1f90556f20fb5508c4e859da7abf667a00967b4 (diff)
parent5b94ae93f3d00f5afe3f1d957aad76173ed7e705 (diff)
downloadrust-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/libsyntax')
-rw-r--r--src/libsyntax/ast_map.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs
index e3023b919f8..be67998ac5d 100644
--- a/src/libsyntax/ast_map.rs
+++ b/src/libsyntax/ast_map.rs
@@ -73,7 +73,7 @@ pub enum ast_node {
     node_variant(variant, @item, @path),
     node_expr(@Expr),
     node_stmt(@Stmt),
-    node_arg,
+    node_arg(@Pat),
     node_local(Ident),
     node_block(Block),
     node_struct_ctor(@struct_def, @item, @path),
@@ -171,7 +171,7 @@ impl Ctx {
               sp: codemap::Span,
               id: NodeId) {
         for a in decl.inputs.iter() {
-            self.map.insert(a.id, node_arg);
+            self.map.insert(a.id, node_arg(a.pat));
         }
         visit::walk_fn(self, fk, decl, body, sp, id, ());
     }
@@ -487,8 +487,8 @@ pub fn node_id_to_str(map: map, id: NodeId, itr: @ident_interner) -> ~str {
         fmt!("stmt %s (id=%?)",
              pprust::stmt_to_str(stmt, itr), id)
       }
-      Some(&node_arg) => {
-        fmt!("arg (id=%?)", id)
+      Some(&node_arg(pat)) => {
+        fmt!("arg %s (id=%?)", pprust::pat_to_str(pat, itr), id)
       }
       Some(&node_local(ident)) => {
         fmt!("local (id=%?, name=%s)", id, itr.get(ident.name))