From: Rico Tzschichholz Date: Sat, 14 Sep 2019 17:22:36 +0000 (+0200) Subject: vala: Run FlowAnalyzer on all given source-files X-Git-Tag: 0.44.8~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d92124bcbc79c1b71255790523b326b3e453322;p=thirdparty%2Fvala.git vala: Run FlowAnalyzer on all given source-files This is a regression triggered by 8f3a0a0b64e0c7fbcc9231c3058247920dd6eeda where we rely on information gathered by it and its changes to the AST. Silence "never used" warnings for external-package symbols. Fixes https://gitlab.gnome.org/GNOME/vala/issues/843 --- diff --git a/vala/valaflowanalyzer.vala b/vala/valaflowanalyzer.vala index dc7e471a3..29349e7a1 100644 --- a/vala/valaflowanalyzer.vala +++ b/vala/valaflowanalyzer.vala @@ -108,12 +108,9 @@ public class Vala.FlowAnalyzer : CodeVisitor { this.context = context; all_basic_blocks = new HashSet (); - /* we're only interested in non-pkg source files */ var source_files = context.get_source_files (); foreach (SourceFile file in source_files) { - if (file.file_type == SourceFileType.SOURCE) { - file.accept (this); - } + file.accept (this); } all_basic_blocks = null; @@ -145,7 +142,7 @@ public class Vala.FlowAnalyzer : CodeVisitor { } public override void visit_field (Field f) { - if (f.is_internal_symbol () && !f.used) { + if (f.is_internal_symbol () && !f.used && !f.external_package) { if (!f.is_private_symbol () && (context.internal_header_filename != null || context.use_fast_vapi)) { // do not warn if internal member may be used outside this compilation unit } else { @@ -169,7 +166,7 @@ public class Vala.FlowAnalyzer : CodeVisitor { } public override void visit_method (Method m) { - if (m.is_internal_symbol () && !m.used && !m.entry_point + if (m.is_internal_symbol () && !m.used && !m.entry_point && !m.external_package && !m.overrides && (m.base_interface_method == null || m.base_interface_method == m) && !(m is CreationMethod)) { if (!m.is_private_symbol () && (context.internal_header_filename != null || context.use_fast_vapi)) {