It looks fine to me.

 - Daniel


On Mon, Nov 12, 2012 at 4:42 PM, Alexander Kornienko <[email protected]>wrote:

> Daniel, any thoughts on this?
>
>
> On Thu, Nov 8, 2012 at 1:43 AM, Alexander Kornienko <[email protected]>wrote:
>
>> Hi ddunbar, doug.gregor,
>>
>> This will help make more supportable tests, that specify source file line
>> number in RUN: lines (most tests in tools/clang/test/Index/ and
>> tools/clang/test/CodeCompletion/).
>>
>> With this substitution it's easier to insert/remove/move lines in test
>> files without breaking fragile connection between RUN: lines and test file
>> contents.
>>
>> http://llvm-reviews.chandlerc.com/D105
>>
>> Files:
>>   utils/lit/lit/TestRunner.py
>>
>> Index: utils/lit/lit/TestRunner.py
>> ===================================================================
>> --- utils/lit/lit/TestRunner.py
>> +++ utils/lit/lit/TestRunner.py
>> @@ -432,15 +432,26 @@
>>      script = []
>>      xfails = []
>>      requires = []
>> +    line_number = 0
>>      for ln in open(sourcepath):
>> +        line_number += 1
>>          if 'RUN:' in ln:
>>              # Isolate the command to run.
>>              index = ln.index('RUN:')
>>              ln = ln[index+4:]
>>
>>              # Trim trailing whitespace.
>>              ln = ln.rstrip()
>>
>> +            # Substitute line number expressions
>> +            ln = re.sub('%\(line\)', str(line_number), ln)
>> +            def replace_line_number(match):
>> +                if match.group(1) == '+':
>> +                    return str(line_number + int(match.group(2)))
>> +                if match.group(1) == '-':
>> +                    return str(line_number - int(match.group(2)))
>> +            ln = re.sub('%\(line *([\+-]) *(\d+)\)',
>> replace_line_number, ln)
>> +
>>              # Collapse lines with trailing '\\'.
>>              if script and script[-1][-1] == '\\':
>>                  script[-1] = script[-1][:-1] + ln
>>
>
>
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to