2022-12-16 20:03:39 +00:00
|
|
|
#!/usr/bin/env python3
|
2017-01-08 11:51:34 +00:00
|
|
|
|
2019-12-01 11:48:19 +00:00
|
|
|
##===--- scrub-logs.py - generate README from Wiki sources ----------------===##
|
2017-01-08 11:51:34 +00:00
|
|
|
#
|
2019-12-01 11:48:19 +00:00
|
|
|
# The LLVM Compiler Infrastructure
|
2017-01-08 11:51:34 +00:00
|
|
|
#
|
|
|
|
# This file is distributed under the University of Illinois Open Source
|
|
|
|
# License. See LICENSE.TXT for details.
|
|
|
|
#
|
|
|
|
##===----------------------------------------------------------------------===##
|
|
|
|
|
|
|
|
"""Scrub irrelevant details from IWYU/Clang logs.
|
|
|
|
|
|
|
|
When Clang changes upstream, we usually look for differences in the AST to
|
|
|
|
explain the new behavior. This script makes that easier by scrubbing pointer
|
|
|
|
values and path prefixes from ast-dump output, so they can be diffed directly.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import re
|
|
|
|
import sys
|
2017-05-01 14:49:28 +01:00
|
|
|
import fileinput
|
2017-01-08 11:51:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
def strip_path_prefix(line):
|
|
|
|
line = re.sub(r'<.*(llvm[\\/]tools[\\/].*):', r'<\1:', line)
|
|
|
|
return line
|
|
|
|
|
|
|
|
|
|
|
|
def strip_addrs(line):
|
2017-01-23 19:43:38 +00:00
|
|
|
line = re.sub(r'\b(0x)?[0-9A-Fa-f]{6,16}', '', line)
|
2017-01-08 11:51:34 +00:00
|
|
|
return line
|
|
|
|
|
|
|
|
|
2017-05-01 14:49:28 +01:00
|
|
|
def main():
|
|
|
|
for line in fileinput.input():
|
|
|
|
line = line.strip()
|
|
|
|
line = strip_addrs(line)
|
|
|
|
line = strip_path_prefix(line)
|
|
|
|
print(line)
|
2017-01-08 11:51:34 +00:00
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2017-05-01 14:49:28 +01:00
|
|
|
sys.exit(main())
|