]> git.lizzy.rs Git - rust.git/commitdiff
debuginfo: Add comment on is_local_to_unit parameter.
authorMichael Woerister <michaelwoerister@gmail>
Sat, 14 Dec 2013 16:12:59 +0000 (17:12 +0100)
committerMichael Woerister <michaelwoerister@gmail>
Mon, 16 Dec 2013 09:23:28 +0000 (10:23 +0100)
src/librustc/middle/trans/debuginfo.rs

index 2a1aada6d24be4304229b0ce1900dc58a609eeb0..0783d5b418f2166d8953629e2050ea2b0773527c 100644 (file)
@@ -690,6 +690,13 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
 
     // Clang sets this parameter to the opening brace of the function's block, so let's do this too.
     let scope_line = span_start(cx, top_level_block.span).line;
+
+    // The is_local_to_unit flag indicates whether a function is local to the current compilation
+    // unit (i.e. if it is *static* in the C-sense). The *reachable* set should provide a good
+    // approximation of this, as it contains everything that might leak out of the current crate
+    // (by being externally visible or by being inlined into something externally visible). It might
+    // better to use the `exported_items` set from `driver::CrateAnalysis` in the future, but (atm)
+    // this set is not available in the translation pass.
     let is_local_to_unit = !cx.reachable.contains(&fn_ast_id);
 
     let fn_metadata = function_name.with_c_str(|function_name| {