[clang-tools-extra] r245683 - Tweak clang-tidy-diff.py to recognize "filename" in the diff ourput.

Yaron Keren via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 21 03:56:14 PDT 2015


Whenever is any special character in the filename, such as space or
backslash (Windows), some examples:

On Windows:
--- ".\\a.cpp"  2015-08-21 00:22:57.885370200 +0300
+++ b.cpp       2015-08-21 01:05:28.726269900 +0300

--- ./a.cpp     2015-08-21 00:22:57.885370200 +0300
+++ b.cpp       2015-08-21 01:05:28.726269900 +0300

--- "a a.cpp"   2015-08-21 00:22:57.885370200 +0300
+++ b.cpp       2015-08-21 01:05:28.726269900 +0300

On Linux:
~$ diff -U0 ./a.cpp b\ b.cpp
--- ./a.cpp     2015-08-14 00:27:03.569276652 +0300
+++ "b b.cpp"   2015-08-21 13:54:26.787896719 +0300

filename with space will break current clang-tidy-diff.py on all platforms,
the regular expression does not match quotes.
There is surely some Python package to process filenames correctly if this
ever become a problem.


2015-08-21 13:37 GMT+03:00 Alexander Kornienko <alexfh at google.com>:

> On Fri, Aug 21, 2015 at 11:27 AM, Yaron Keren via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Author: yrnkrn
>> Date: Fri Aug 21 04:27:24 2015
>> New Revision: 245683
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=245683&view=rev
>> Log:
>> Tweak clang-tidy-diff.py to recognize "filename" in the diff ourput
>
>
> Out of curiosity, when does this happen? (I mean quotes around the file
> name)
>
>
>>
>>
>
>> Modified:
>>     clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
>>
>> Modified: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
>> URL:
>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py?rev=245683&r1=245682&r2=245683&view=diff
>>
>> ==============================================================================
>> --- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py (original)
>> +++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py Fri Aug 21
>> 04:27:24 2015
>> @@ -67,7 +67,7 @@ def main():
>>    filename = None
>>    lines_by_file = {}
>>    for line in sys.stdin:
>> -    match = re.search('^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
>> +    match = re.search('^\+\+\+\ \"?(.*?/){%s}([^ \t\"]*)' % args.p, line)
>>      if match:
>>        filename = match.group(2)
>>      if filename == None:
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150821/6d544af3/attachment.html>


More information about the cfe-commits mailing list