From 2f3f9622f30facba85ca2396dc4f6c0ce0725687 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Mon, 20 Sep 2010 06:56:32 -0400 Subject: [PATCH] SourceFile: change the definition of 'used' Consider a source file as used only if actual C code (or declarations) have been generated from something in that source file. This greatly reduces the number of dependencies listed for compilations that touch a large number of symbols in trivial ways without really making use of them (for example, when listing a very large number of unused fast-vapi files, as parvala does). --- codegen/valaccodedeclarationspace.vala | 1 + vala/valasourcefile.vala | 2 +- vala/valasymbol.vala | 11 +---------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/codegen/valaccodedeclarationspace.vala b/codegen/valaccodedeclarationspace.vala index 4ff764096..7c13be789 100644 --- a/codegen/valaccodedeclarationspace.vala +++ b/codegen/valaccodedeclarationspace.vala @@ -44,6 +44,7 @@ public class Vala.CCodeDeclarationSpace { if (add_declaration (name)) { return true; } + sym.source_reference.file.used = true; if (sym.external_package || (!is_header && CodeContext.get ().use_header && !sym.is_internal_symbol ())) { // add appropriate include file foreach (string header_filename in sym.get_cheader_filenames ()) { diff --git a/vala/valasourcefile.vala b/vala/valasourcefile.vala index 28397cf4b..9bb225f40 100644 --- a/vala/valasourcefile.vala +++ b/vala/valasourcefile.vala @@ -69,7 +69,7 @@ public class Vala.SourceFile { /** * If the file has been used (ie: if anything in the file has - * been found by symbol resolution). + * been emitted into C code as a definition or declaration). */ public bool used { get; set; } diff --git a/vala/valasymbol.vala b/vala/valasymbol.vala index 9caaa2789..b63662456 100644 --- a/vala/valasymbol.vala +++ b/vala/valasymbol.vala @@ -97,16 +97,7 @@ public abstract class Vala.Symbol : CodeNode { /** * Specifies whether this symbol has been accessed. */ - public bool used { - get { return _used; } - set { - _used = value; - if (_used && source_reference != null) { - source_reference.file.used = true; - } - } - } - bool _used; + public bool used { get; set; } /** * Specifies the accessibility of this symbol. Public accessibility -- 2.47.2