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

Jordan Rose jordan_rose at apple.com
Thu Mar 20 10:50:39 PDT 2014


On Mar 20, 2014, at 10:48 , Brennan Shacklett <bp.shacklett at gmail.com> wrote:

>> --- 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 = $_;
>   }

Man, how many times can I get this wrong? Thanks, Brennan. Committed as r204362.

Jordan



More information about the cfe-commits mailing list