3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 22:09:26 +01:00

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; $mod->preprocess;
if($cmdline =~ m/-?-version/) { $mod->postprocess if not $mod->{error} and not $mod->{done};
# 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};
if (exists $mod->{no_output} or not length $mod->{output}) { if (exists $mod->{no_output} or not length $mod->{output}) {
$mod->{output} .= "\n" if length $mod->{output}; $mod->{output} .= "\n" if length $mod->{output};

View File

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

View File

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