summaryrefslogtreecommitdiffstats
path: root/clang/utils/check_cfc/obj_diff.py
diff options
context:
space:
mode:
authorSerge Guelton <sguelton@quarkslab.com>2018-12-18 16:04:21 +0000
committerSerge Guelton <sguelton@quarkslab.com>2018-12-18 16:04:21 +0000
commitd458974c454ee977dc0bd3b9f1116df7d4037ab2 (patch)
tree31145842c1fd7a6a775c7f9c506af4bbc67eb9dd /clang/utils/check_cfc/obj_diff.py
parente9effe9744bda67051ab2ff0a76ecc9e99488efa (diff)
downloadbcm5719-llvm-d458974c454ee977dc0bd3b9f1116df7d4037ab2.tar.gz
bcm5719-llvm-d458974c454ee977dc0bd3b9f1116df7d4037ab2.zip
Portable Python script across Python version
In Python3, dict.items, dict.keys, dict.values, zip, map and filter no longer return lists, they create generator instead. The portability patch consists in forcing an extra `list` call if the result is actually used as a list. `map` are replaced by list comprehension and `filter` by filtered list comprehension. Differential Revision: https://reviews.llvm.org/D55197 llvm-svn: 349501
Diffstat (limited to 'clang/utils/check_cfc/obj_diff.py')
-rwxr-xr-xclang/utils/check_cfc/obj_diff.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/utils/check_cfc/obj_diff.py b/clang/utils/check_cfc/obj_diff.py
index cc4c2a97d5e..61b9118df83 100755
--- a/clang/utils/check_cfc/obj_diff.py
+++ b/clang/utils/check_cfc/obj_diff.py
@@ -25,7 +25,7 @@ def disassemble(objfile):
if p.returncode or err:
print("Disassemble failed: {}".format(objfile))
sys.exit(1)
- return filter(keep_line, out.split(os.linesep))
+ return [line for line in out.split(os.linesep) if keep_line(line)]
def dump_debug(objfile):
"""Dump all of the debug info from a file."""
@@ -34,7 +34,7 @@ def dump_debug(objfile):
if p.returncode or err:
print("Dump debug failed: {}".format(objfile))
sys.exit(1)
- return filter(keep_line, out.split(os.linesep))
+ return [line for line in out.split(os.linesep) if keep_line(line)]
def first_diff(a, b, fromfile, tofile):
"""Returns the first few lines of a difference, if there is one. Python
OpenPOWER on IntegriCloud