Title: [171693] trunk/Tools
Revision
171693
Author
[email protected]
Date
2014-07-28 13:48:50 -0700 (Mon, 28 Jul 2014)

Log Message

Add support for running the Clang static analyzer when building WebKit and JSC
https://bugs.webkit.org/show_bug.cgi?id=134955

Reviewed by Brent Fulgham.

* Scripts/build-jsc: Added command line options -[no]-analyze (disabled by default).
* Scripts/build-webkit: Add --analyze command line option to build-webkit to enable
running the Clang static analyzer.
* Scripts/webkitdirs.pm:
(XcodeStaticAnalyzerOption): Added.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (171692 => 171693)


--- trunk/Tools/ChangeLog	2014-07-28 20:44:50 UTC (rev 171692)
+++ trunk/Tools/ChangeLog	2014-07-28 20:48:50 UTC (rev 171693)
@@ -1,3 +1,16 @@
+2014-07-28  Daniel Bates  <[email protected]>
+
+        Add support for running the Clang static analyzer when building WebKit and JSC
+        https://bugs.webkit.org/show_bug.cgi?id=134955
+
+        Reviewed by Brent Fulgham.
+
+        * Scripts/build-jsc: Added command line options -[no]-analyze (disabled by default).
+        * Scripts/build-webkit: Add --analyze command line option to build-webkit to enable
+        running the Clang static analyzer.
+        * Scripts/webkitdirs.pm:
+        (XcodeStaticAnalyzerOption): Added.
+
 2014-07-24  David Farler  <[email protected]>
 
         Allow for multiple DumpRenderTree and WebKitTestRunner instances in the iOS Simulator

Modified: trunk/Tools/Scripts/build-jsc (171692 => 171693)


--- trunk/Tools/Scripts/build-jsc	2014-07-28 20:44:50 UTC (rev 171692)
+++ trunk/Tools/Scripts/build-jsc	2014-07-28 20:48:50 UTC (rev 171693)
@@ -37,6 +37,7 @@
 
 sub writeCongrats();
 
+my $shouldRunStaticAnalyzer = 0;
 my $coverageSupport = 0;
 my $showHelp = 0;
 my $ftlJIT = isAppleWebKit();
@@ -54,6 +55,7 @@
 my $usage = <<EOF;
 Usage: $programName [options] [options to pass to build system]
   --help                        Show this help message
+  --[no-]analyze                Toggle code static analysis (default: $shouldRunStaticAnalyzer)
   --[no-]coverage               Toggle code coverage support (default: $coverageSupport)
   --[no-]ftl-jit                Toggle FTL JIT support (default: $ftlJIT)
   --[no-]copy-libraries         Toggle whether to copy libraries (default: $copyLibraries)
@@ -64,6 +66,7 @@
 EOF
 
 GetOptions(
+    'analyze!' => \$shouldRunStaticAnalyzer,
     'coverage!' => \$coverageSupport,
     'help' => \$showHelp,
     'ftl-jit!' => \$ftlJIT,
@@ -83,7 +86,9 @@
 setConfiguration();
 chdirWebKit();
 my @options = XcodeOptions();
-my @coverageSupportOptions = ($coverageSupport) ? XcodeCoverageSupportOptions() : ();
+my @additionalSupportOptions = ();
+push @additionalSupportOptions, XcodeCoverageSupportOptions() if $coverageSupport;
+push @additionalSupportOptions, XcodeStaticAnalyzerOption() if $shouldRunStaticAnalyzer;
 
 if (cmakeBasedPortName()) {
     $cmakeArgs .= " -DENABLE_LLINT_C_LOOP=ON" if $forceCLoop;
@@ -120,7 +125,7 @@
     my $result;
     chdir $projectDirectory or die "Can't find $projectName directory to build from";
     if (isAppleMacWebKit()) {
-        $result = system "sh", "-c", ('xcodebuild -project ' . $projectName . '.xcodeproj "$@" | grep -v setenv && exit ${PIPESTATUS[0]}'), "xcodebuild",  @options, @ARGV, @coverageSupportOptions;
+        $result = system "sh", "-c", ('xcodebuild -project ' . $projectName . '.xcodeproj "$@" | grep -v setenv && exit ${PIPESTATUS[0]}'), "xcodebuild",  @options, @ARGV, @additionalSupportOptions;
     } elsif (isAppleWinWebKit() || isWinCairo()) {
         # WTF is a part of _javascript_Core.sln because jsc.exe wouldn't start otherwise.
         if ($projectName ne "WTF") {

Modified: trunk/Tools/Scripts/build-webkit (171692 => 171693)


--- trunk/Tools/Scripts/build-webkit	2014-07-28 20:44:50 UTC (rev 171692)
+++ trunk/Tools/Scripts/build-webkit	2014-07-28 20:48:50 UTC (rev 171693)
@@ -62,6 +62,7 @@
 my $noWebKit1 = 0;
 my $noWebKit2 = 0;
 my $coverageSupport = 0;
+my $shouldRunStaticAnalyzer = 0;
 my $startTime = time();
 
 my @features = getFeatureOptionList();
@@ -91,7 +92,8 @@
   --sdk=<sdk>                       Use a specific Xcode SDK (iOS and Mac only)
   --device                          Use the current iphoneos.internal SDK (iOS only)
   --simulator                       Use the current iphonesimulator SDK (iOS only)
-  --coverage                        Enable Code Coverage support (Mac only)
+  --coverage                        Enable code coverage support (Mac only)
+  --analyze                         Enable static anaylsis (iOS and Mac only)
 
   --efl                             Build the EFL port
   --gtk                             Build the GTK+ port
@@ -125,6 +127,7 @@
     'no-webkit1' => \$noWebKit1,
     'no-webkit2' => \$noWebKit2,
     'coverage' => \$coverageSupport,
+    'analyze' => \$shouldRunStaticAnalyzer,
 );
 
 # Build usage text and options list from features
@@ -284,6 +287,7 @@
     if (isAppleMacWebKit()) {
         my @local_options = @options;
         push @local_options, XcodeCoverageSupportOptions() if $coverageSupport;
+        push @local_options, XcodeStaticAnalyzerOption() if $shouldRunStaticAnalyzer;
         my $projectPath = $project =~ /gtest/ ? "xcode/gtest" : $project;
         if (isIOSWebKit()){
             push @local_options, qw(-target WebKitTestRunnerApp) if ($project eq "WebKitTestRunner") && !$clean;

Modified: trunk/Tools/Scripts/webkitdirs.pm (171692 => 171693)


--- trunk/Tools/Scripts/webkitdirs.pm	2014-07-28 20:44:50 UTC (rev 171692)
+++ trunk/Tools/Scripts/webkitdirs.pm	2014-07-28 20:48:50 UTC (rev 171693)
@@ -49,9 +49,11 @@
    $VERSION     = 1.00;
    @ISA         = qw(Exporter);
    @EXPORT      = qw(
+       &XcodeCoverageSupportOptions
        &XcodeOptionString
        &XcodeOptionStringNoConfig
        &XcodeOptions
+       &XcodeStaticAnalyzerOption
        &appDisplayNameFromBundle
        &baseProductDir
        &chdirWebKit
@@ -643,6 +645,11 @@
     return @coverageSupportOptions;
 }
 
+sub XcodeStaticAnalyzerOption()
+{
+    return "RUN_CLANG_STATIC_ANALYZER=YES";
+}
+
 my $passedConfiguration;
 my $searchedForPassedConfiguration;
 sub determinePassedConfiguration
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to