summaryrefslogtreecommitdiffstats
path: root/clang/tools
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-04-20 21:23:58 +0000
committerEric Fiselier <eric@efcs.ca>2017-04-20 21:23:58 +0000
commit3f5152d212898a6e1b6b124c9d5a8287f7b64bb7 (patch)
tree9d66f4c73b01c91aa6a78cbd72ba13a7527d7f6a /clang/tools
parent8e63e5417737401791a5f6892258c46c810818d8 (diff)
downloadbcm5719-llvm-3f5152d212898a6e1b6b124c9d5a8287f7b64bb7.tar.gz
bcm5719-llvm-3f5152d212898a6e1b6b124c9d5a8287f7b64bb7.zip
Fix Python 2 vs 3 incompatability with dict.items() vs iteritems()
llvm-svn: 300895
Diffstat (limited to 'clang/tools')
-rwxr-xr-xclang/tools/clang-format/git-clang-format7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format
index 12146bf77c9..3d1ba8a3c10 100755
--- a/clang/tools/clang-format/git-clang-format
+++ b/clang/tools/clang-format/git-clang-format
@@ -345,8 +345,13 @@ def run_clang_format_and_save_to_tree(changed_lines, revision=None,
"""Run clang-format on each file and save the result to a git tree.
Returns the object ID (SHA-1) of the created tree."""
+ def iteritems(container):
+ try:
+ return container.iteritems() # Python 2
+ except AttributeError:
+ return container.items() # Python 3
def index_info_generator():
- for filename, line_ranges in changed_lines.viewitems():
+ for filename, line_ranges in iteritems(changed_lines):
if revision:
git_metadata_cmd = ['git', 'ls-tree',
'%s:%s' % (revision, os.path.dirname(filename)),
OpenPOWER on IntegriCloud