r222851 - [analyzer] Indented code within the DisplayHelp sub.

Anton Yartsev anton.yartsev at gmail.com
Wed Nov 26 13:53:40 PST 2014


Author: ayartsev
Date: Wed Nov 26 15:53:39 2014
New Revision: 222851

URL: http://llvm.org/viewvc/llvm-project?rev=222851&view=rev
Log:
[analyzer] Indented code within the DisplayHelp sub.

Modified:
    cfe/trunk/tools/scan-build/scan-build

Modified: cfe/trunk/tools/scan-build/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/scan-build?rev=222851&r1=222850&r2=222851&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/scan-build (original)
+++ cfe/trunk/tools/scan-build/scan-build Wed Nov 26 15:53:39 2014
@@ -1221,104 +1221,104 @@ LOADING CHECKERS:
  -load-plugin [plugin library]
 ENDTEXT
 
-# Query clang for list of checkers that are enabled.
+  # Query clang for list of checkers that are enabled.
 
-# create a list to load the plugins via the 'Xclang' command line
-# argument
-my @PluginLoadCommandline_xclang;
-foreach my $param ( @PluginsToLoad ) {
-  push ( @PluginLoadCommandline_xclang, "-Xclang" );
-  push ( @PluginLoadCommandline_xclang, $param );
-}
-my %EnabledCheckers;
-foreach my $lang ("c", "objective-c", "objective-c++", "c++") {
-  pipe(FROM_CHILD, TO_PARENT);
-  my $pid = fork();
-  if ($pid == 0) {
-    close FROM_CHILD;
-    open(STDOUT,">&", \*TO_PARENT);
-    open(STDERR,">&", \*TO_PARENT);
-    exec $Clang, ( @PluginLoadCommandline_xclang, '--analyze', '-x', $lang, '-', '-###');
-  }
-  close(TO_PARENT);
-  while(<FROM_CHILD>) {
-    foreach my $val (split /\s+/) {
-      $val =~ s/\"//g;
-      if ($val =~ /-analyzer-checker\=([^\s]+)/) {
-        $EnabledCheckers{$1} = 1;
+  # create a list to load the plugins via the 'Xclang' command line
+  # argument
+  my @PluginLoadCommandline_xclang;
+  foreach my $param ( @PluginsToLoad ) {
+    push ( @PluginLoadCommandline_xclang, "-Xclang" );
+    push ( @PluginLoadCommandline_xclang, $param );
+  }
+  my %EnabledCheckers;
+  foreach my $lang ("c", "objective-c", "objective-c++", "c++") {
+    pipe(FROM_CHILD, TO_PARENT);
+    my $pid = fork();
+    if ($pid == 0) {
+      close FROM_CHILD;
+      open(STDOUT,">&", \*TO_PARENT);
+      open(STDERR,">&", \*TO_PARENT);
+      exec $Clang, ( @PluginLoadCommandline_xclang, '--analyze', '-x', $lang, '-', '-###');
+    }
+    close(TO_PARENT);
+    while(<FROM_CHILD>) {
+      foreach my $val (split /\s+/) {
+        $val =~ s/\"//g;
+        if ($val =~ /-analyzer-checker\=([^\s]+)/) {
+          $EnabledCheckers{$1} = 1;
+        }
       }
     }
+    waitpid($pid,0);
+    close(FROM_CHILD);
   }
-  waitpid($pid,0);
-  close(FROM_CHILD);
-}
-
-# Query clang for complete list of checkers.
-if (defined $Clang && -x $Clang) {
-  pipe(FROM_CHILD, TO_PARENT);
-  my $pid = fork();
-  if ($pid == 0) {
-    close FROM_CHILD;
-    open(STDOUT,">&", \*TO_PARENT);
-    open(STDERR,">&", \*TO_PARENT);
-    exec $Clang, ('-cc1', @PluginsToLoad , '-analyzer-checker-help');
-  }
-  close(TO_PARENT);
-  my $foundCheckers = 0;
-  while(<FROM_CHILD>) {
-    if (/CHECKERS:/) {
-      $foundCheckers = 1;
-      last;
+
+  # Query clang for complete list of checkers.
+  if (defined $Clang && -x $Clang) {
+    pipe(FROM_CHILD, TO_PARENT);
+    my $pid = fork();
+    if ($pid == 0) {
+      close FROM_CHILD;
+      open(STDOUT,">&", \*TO_PARENT);
+      open(STDERR,">&", \*TO_PARENT);
+      exec $Clang, ('-cc1', @PluginsToLoad , '-analyzer-checker-help');
     }
-  }
-  if (!$foundCheckers) {
-    print "  *** Could not query Clang for the list of available checkers.";
-  }
-  else {
-    print("\nAVAILABLE CHECKERS:\n\n");
-    my $skip = 0;
+    close(TO_PARENT);
+    my $foundCheckers = 0;
     while(<FROM_CHILD>) {
-      if (/experimental/) {
-        $skip = 1;
-        next;
-      }
-      if ($skip) {
-        next if (!/^\s\s[^\s]/);
-        $skip = 0;
+      if (/CHECKERS:/) {
+        $foundCheckers = 1;
+        last;
       }
-      s/^\s\s//;
-      if (/^([^\s]+)/) {
-        # Is the checker enabled?
-        my $checker = $1;
-        my $enabled = 0;
-        my $aggregate = "";
-        foreach my $domain (split /\./, $checker) {
-          $aggregate .= $domain;
-          if ($EnabledCheckers{$aggregate}) {
-            $enabled =1;
-            last;
-          }
-          # append a dot, if an additional domain is added in the next iteration
-          $aggregate .= ".";
+    }
+    if (!$foundCheckers) {
+      print "  *** Could not query Clang for the list of available checkers.";
+    }
+    else {
+      print("\nAVAILABLE CHECKERS:\n\n");
+      my $skip = 0;
+      while(<FROM_CHILD>) {
+        if (/experimental/) {
+          $skip = 1;
+          next;
+        }
+        if ($skip) {
+          next if (!/^\s\s[^\s]/);
+          $skip = 0;
         }
+        s/^\s\s//;
+        if (/^([^\s]+)/) {
+          # Is the checker enabled?
+          my $checker = $1;
+          my $enabled = 0;
+          my $aggregate = "";
+          foreach my $domain (split /\./, $checker) {
+            $aggregate .= $domain;
+            if ($EnabledCheckers{$aggregate}) {
+              $enabled =1;
+              last;
+            }
+            # append a dot, if an additional domain is added in the next iteration
+            $aggregate .= ".";
+          }
 
-        if ($enabled) {
-          print " + ";
+          if ($enabled) {
+            print " + ";
+          }
+          else {
+            print "   ";
+          }
         }
         else {
           print "   ";
         }
+        print $_;
       }
-      else {
-        print "   ";
-      }
-      print $_;
+      print "\nNOTE: \"+\" indicates that an analysis is enabled by default.\n"
     }
-    print "\nNOTE: \"+\" indicates that an analysis is enabled by default.\n"
+    waitpid($pid,0);
+    close(FROM_CHILD);
   }
-  waitpid($pid,0);
-  close(FROM_CHILD);
-}
 
 print <<ENDTEXT
 





More information about the cfe-commits mailing list