]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
SourceFile: change the definition of 'used'
authorRyan Lortie <desrt@desrt.ca>
Wed, 6 Oct 2010 20:40:40 +0000 (22:40 +0200)
committerJürg Billeter <j@bitron.ch>
Wed, 6 Oct 2010 20:41:33 +0000 (22:41 +0200)
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).

Fixes bug 630144.

codegen/valaccodebasemodule.vala
vala/valasourcefile.vala
vala/valasymbol.vala

index 9b0f5a4a77cc3a61cf9064854c51463d2e34b41e..24c4dee900809e276e14c938183457140306bf60 100644 (file)
@@ -486,6 +486,7 @@ public class Vala.CCodeBaseModule : CodeGenerator {
                if (decl_space.add_declaration (name)) {
                        return true;
                }
+               sym.source_reference.file.used = true;
                if (sym.external_package || (!decl_space.is_header && CodeContext.get ().use_header && !sym.is_internal_symbol ())) {
                        // add appropriate include file
                        foreach (string header_filename in sym.get_cheader_filenames ()) {
index 28397cf4b8bee123c713b00503a79906167fcd2a..9bb225f40b93764f081ffa4a6c076d59189cb8b8 100644 (file)
@@ -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; }
 
index e65717be8794bc7abe1d6c86ab8b06638bf0dc7e..7d822a159072751cd24ee2dbb6c8d766d96cf803 100644 (file)
@@ -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