[scan-build-py] fix some line separator issues

Differential Revision: https://reviews.llvm.org/D30600

llvm-svn: 297266
This commit is contained in:
Laszlo Nagy 2017-03-08 09:27:53 +00:00
parent 317c539e19
commit ed739d902d
2 changed files with 7 additions and 6 deletions

View File

@ -207,9 +207,9 @@ class Configure(object):
if m:
key = m.group(1)
if key not in definitions or not definitions[key]:
return '/* #undef {} */\n'.format(key)
return '/* #undef {0} */{1}'.format(key, os.linesep)
else:
return '#define {}\n'.format(key)
return '#define {0}{1}'.format(key, os.linesep)
return line
with open(template, 'r') as src_handle:

View File

@ -336,11 +336,12 @@ def parse_crash(filename):
match = re.match(r'(.*)\.info\.txt', filename)
name = match.group(1) if match else None
with open(filename) as handler:
lines = handler.readlines()
with open(filename, mode='rb') as handler:
# this is a workaround to fix windows read '\r\n' as new lines.
lines = [line.decode().rstrip() for line in handler.readlines()]
return {
'source': lines[0].rstrip(),
'problem': lines[1].rstrip(),
'source': lines[0],
'problem': lines[1],
'file': name,
'info': name + '.info.txt',
'stderr': name + '.stderr.txt'