--- /opt/rh/llvm-toolset-7.0/root/bin/scan-build.orig 2020-10-07 18:21:21.035260832 +0000 +++ /opt/rh/llvm-toolset-7.0/root/bin/scan-build 2020-10-07 18:23:27.503366066 +0000 @@ -58,6 +58,7 @@ KeepEmpty => 0, # Don't remove output directory even with 0 results. EnableCheckers => {}, DisableCheckers => {}, + Excludes => [], UseCC => undef, # C compiler to use for compilation. UseCXX => undef, # C++ compiler to use for compilation. AnalyzerTarget => undef, @@ -420,6 +421,20 @@ # The file no longer exists: use the original path. $BugFile = $1; } + + # Get just the path + my $p = dirname($BugFile); + # Check if the path is found in the list of exclude + if (grep { $p =~ m/$_/ } @{$Options{Excludes}}) { + if ($Options{Verbose}) { + Diag("File '$BugFile' deleted: part of an ignored directory.\n"); + } + + # File in an ignored directory. Remove it + unlink("$Dir/$FName"); + return; + } + UpdatePrefix($BugFile); } elsif (/$/) { @@ -1698,6 +1713,15 @@ next; } + if ($arg eq "--exclude") { + shift @$Args; + my $arg = shift @$Args; + # Remove the trailing slash if any + $arg =~ s|/$||; + push @{$Options{Excludes}}, $arg; + next; + } + if ($arg eq "-load-plugin") { shift @$Args; push @{$Options{PluginsToLoad}}, shift @$Args;