]> granicus.if.org Git - clang/commitdiff
[analyzer] scan-build for Windows
authorAnton Yartsev <anton.yartsev@gmail.com>
Thu, 2 May 2013 00:52:46 +0000 (00:52 +0000)
committerAnton Yartsev <anton.yartsev@gmail.com>
Thu, 2 May 2013 00:52:46 +0000 (00:52 +0000)
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

tools/scan-build/c++-analyzer
tools/scan-build/scan-build
tools/scan-build/scan-build.bat [new file with mode: 0644]

index ca10bf547dc273778c757137962a08226256d847..dda5db9c7d925c50643d3a2a91c0dd7fce6fa01e 120000 (symlink)
@@ -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';
index 2b07d6b6bca4ff84371138c7d0607eba82adb62e..35f852e70b22cf289bae428b977130e498630763 100755 (executable)
@@ -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 (file)
index 0000000..77be674
--- /dev/null
@@ -0,0 +1 @@
+perl -S scan-build %*\r