diff options
author | Anton Yartsev <anton.yartsev@gmail.com> | 2013-05-02 00:52:46 +0000 |
---|---|---|
committer | Anton Yartsev <anton.yartsev@gmail.com> | 2013-05-02 00:52:46 +0000 |
commit | ceb791ccd25b7395bdd9a6d01c30740ad42c09a0 (patch) | |
tree | 160a059abce3a55de4f6c2e44ea010b304d77e2f /tools | |
parent | e2b1246a24e8babf2f58c93713fba16b8edb8e2d (diff) |
[analyzer] scan-build for Windows
The patch allows Windows users to launch scan-build without any additional preparations in the same way as it described in http://clang-analyzer.llvm.org/scan-build.html. The only thing that should be done to make scan-build work from an arbitrary location is to add scan-build folder to the PATH environment variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180900 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
l--------- | tools/scan-build/c++-analyzer | 9 | ||||
-rwxr-xr-x | tools/scan-build/scan-build | 12 | ||||
-rw-r--r-- | tools/scan-build/scan-build.bat | 1 |
3 files changed, 19 insertions, 3 deletions
diff --git a/tools/scan-build/c++-analyzer b/tools/scan-build/c++-analyzer index ca10bf547d..dda5db9c7d 120000 --- a/tools/scan-build/c++-analyzer +++ b/tools/scan-build/c++-analyzer @@ -1 +1,8 @@ -ccc-analyzer
\ No newline at end of file +#!/usr/bin/env perl + +use Cwd qw/ abs_path /; +use File::Basename qw/ dirname /; +# Add scan-build dir to the list of places where perl looks for modules. +use lib dirname(abs_path($0)); + +do 'ccc-analyzer'; diff --git a/tools/scan-build/scan-build b/tools/scan-build/scan-build index 2b07d6b6bc..35f852e70b 100755 --- a/tools/scan-build/scan-build +++ b/tools/scan-build/scan-build @@ -1562,8 +1562,16 @@ if ($ForceDisplayHelp || $RequestDisplayHelp) { } $ClangCXX = $Clang; -$ClangCXX =~ s/\-\d+\.\d+$//; -$ClangCXX .= "++"; +# Determine operating system under which this copy of Perl was built. +my $IsWinBuild = ($^O =~/msys|cygwin|MSWin32/); +if($IsWinBuild) { + $ClangCXX =~ s/.exe$/++.exe/; +} +else { + $ClangCXX =~ s/\-\d+\.\d+$//; + $ClangCXX .= "++"; +} + # Make sure to use "" to handle paths with spaces. $ClangVersion = HtmlEscape(`"$Clang" --version`); diff --git a/tools/scan-build/scan-build.bat b/tools/scan-build/scan-build.bat new file mode 100644 index 0000000000..77be674631 --- /dev/null +++ b/tools/scan-build/scan-build.bat @@ -0,0 +1 @@ +perl -S scan-build %*
|