r180900 - [analyzer] scan-build for Windows

Anton Yartsev anton.yartsev at gmail.com
Wed May 1 17:52:46 PDT 2013


Author: ayartsev
Date: Wed May  1 19:52:46 2013
New Revision: 180900

URL: http://llvm.org/viewvc/llvm-project?rev=180900&view=rev
Log:
[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.

Added:
    cfe/trunk/tools/scan-build/scan-build.bat
Modified:
    cfe/trunk/tools/scan-build/c++-analyzer
    cfe/trunk/tools/scan-build/scan-build

Modified: cfe/trunk/tools/scan-build/c++-analyzer
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/c%2B%2B-analyzer?rev=180900&r1=180899&r2=180900&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/c++-analyzer (original)
+++ cfe/trunk/tools/scan-build/c++-analyzer Wed May  1 19:52:46 2013
@@ -1 +1,8 @@
-link 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';

Modified: cfe/trunk/tools/scan-build/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/scan-build?rev=180900&r1=180899&r2=180900&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/scan-build (original)
+++ cfe/trunk/tools/scan-build/scan-build Wed May  1 19:52:46 2013
@@ -1562,8 +1562,16 @@ if ($ForceDisplayHelp || $RequestDisplay
 }
 
 $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`);
 

Added: cfe/trunk/tools/scan-build/scan-build.bat
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/scan-build.bat?rev=180900&view=auto
==============================================================================
--- cfe/trunk/tools/scan-build/scan-build.bat (added)
+++ cfe/trunk/tools/scan-build/scan-build.bat Wed May  1 19:52:46 2013
@@ -0,0 +1 @@
+perl -S scan-build %*





More information about the cfe-commits mailing list