Refactor handling of --version flags; add --analyze

Move handling of certain language-specific flags out of
compiler_vm_server.pl and into their own language modules.

Add support for clang --analyze.

Java now understands -version.
This commit is contained in:
Pragmatic Software 2015-05-18 20:48:15 -07:00
parent ab39220fd5
commit 03baaeb81c
3 changed files with 19 additions and 7 deletions

View File

@ -126,13 +126,7 @@ sub interpret {
$mod->preprocess;
if($cmdline =~ m/-?-version/) {
# cmdline contained version request, so don't postprocess and just return the version output
$mod->{output} =~ s/\s+\(Ubuntu.*-\d+ubuntu\d+\)//;
return $mod->{output};
}
$mod->postprocess if not $mod->{error};
$mod->postprocess if not $mod->{error} and not $mod->{done};
if (exists $mod->{no_output} or not length $mod->{output}) {
$mod->{output} .= "\n" if length $mod->{output};

View File

@ -6,6 +6,15 @@ use strict;
package _c_base;
use parent '_default';
sub preprocess {
my $self = shift;
$self->SUPER::preprocess;
if ($self->{cmdline} =~ m/--(?:version|analyze)/) {
$self->{done} = 1;
}
}
sub postprocess {
my $self = shift;

View File

@ -6,6 +6,15 @@ use strict;
package java;
use parent '_default';
sub preprocess {
my $self = shift;
$self->SUPER::preprocess;
if ($self->{cmdline} =~ m/-version/) {
$self->{done} = 1;
}
}
sub postprocess {
my $self = shift;