[PATCH] D88784: Improve ccc-analyzer error message
Tom Rix via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 3 09:41:04 PDT 2020
trixirt created this revision.
trixirt added a reviewer: dcoughlin.
trixirt added a project: clang.
Herald added subscribers: cfe-commits, steakhal, ASDenysPetrov, Charusso, dkrupp, donat.nagy, Szelethus, a.sidorin, baloghadamsoftware.
trixirt requested review of this revision.
When ccc-analyzer fails to handle cc args, it outputs only
could not find clang line
To improve this message, print out the errors so now the output
looks like
could not find clang line
Please check errors
clang-12: error: unknown argument: '-fno-ipa-cp-clone'
clang-12: error: unknown argument: '-fno-partial-inlining'
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D88784
Files:
clang/tools/scan-build/libexec/ccc-analyzer
Index: clang/tools/scan-build/libexec/ccc-analyzer
===================================================================
--- clang/tools/scan-build/libexec/ccc-analyzer
+++ clang/tools/scan-build/libexec/ccc-analyzer
@@ -188,12 +188,19 @@
my $mode = shift;
my $Args = shift;
my $line;
+ my $err = "";
my $OutputStream = silent_system($HtmlDir, $Clang, "-###", $mode, @$Args);
while (<$OutputStream>) {
+ $err = $err . $_ if ($_ =~ /error:/);
next if (!/\s"?-cc1"?\s/);
$line = $_;
}
- die "could not find clang line\n" if (!defined $line);
+ if (!defined $line) {
+ print STDERR "could not find clang line\n";
+ print STDERR "Please check errors\n";
+ print STDERR $err;
+ exit 1
+ }
# Strip leading and trailing whitespace characters.
$line =~ s/^\s+|\s+$//g;
my @items = quotewords('\s+', 0, $line);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88784.295986.patch
Type: text/x-patch
Size: 856 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201003/4f2af4e5/attachment.bin>
More information about the cfe-commits
mailing list