r204356 - [analyzer] scan-build: match whitespace instead of word boundaries around flags.

Brennan Shacklett bp.shacklett at gmail.com
Thu Mar 20 10:48:24 PDT 2014


> --- cfe/trunk/tools/scan-build/ccc-analyzer (original)
> +++ cfe/trunk/tools/scan-build/ccc-analyzer Thu Mar 20 11:37:54 2014
> @@ -150,7 +150,7 @@ sub GetCCArgs {
>    close(TO_PARENT);
>    my $line;
>    while (<FROM_CHILD>) {
> -    next if (!/\b-cc1\b/);
> +    next if (!/\s-cc1\s/);
>      $line = $_;
>    }
>  

This regular expression doesn't work on my machine (running Gentoo Linux), 
because the clang driver wraps all arguments to the clang binary in quotes:
"/usr/local/bin/clang-3.5" "-cc1" "-triple" "x86_64-unknown-linux-gnu"

This change fixes the issue for me:
diff --git a/tools/scan-build/ccc-analyzer b/tools/scan-build/ccc-analyzer
index df41936..b5445e6 100755
--- a/tools/scan-build/ccc-analyzer
+++ b/tools/scan-build/ccc-analyzer
@@ -150,7 +150,7 @@ sub GetCCArgs {
   close(TO_PARENT);
   my $line;
   while (<FROM_CHILD>) {
-    next if (!/\s-cc1\s/);
+    next if (!/\s"?-cc1"?\s/);
     $line = $_;
   }
 
-- 
Brennan Shacklett
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ccc-analyzer-quotes.patch
Type: text/x-diff
Size: 357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140320/e3e03db5/attachment.patch>


More information about the cfe-commits mailing list