[PATCH] D107944: [hmaptool] Port to python3
Nathan Lanza via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 11 20:48:55 PDT 2021
lanza created this revision.
lanza requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This is just a few trivial changes -- change the interpreter and fix a
few byte-vs-string issues.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D107944
Files:
clang/utils/hmaptool/hmaptool
Index: clang/utils/hmaptool/hmaptool
===================================================================
--- clang/utils/hmaptool/hmaptool
+++ clang/utils/hmaptool/hmaptool
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from __future__ import absolute_import, division, print_function
import json
@@ -9,8 +9,8 @@
###
-k_header_magic_LE = 'pamh'
-k_header_magic_BE = 'hmap'
+k_header_magic_LE = b'pamh'
+k_header_magic_BE = b'hmap'
def hmap_hash(str):
"""hash(str) -> int
@@ -83,7 +83,7 @@
if len(strtable) != strtable_size:
raise SystemExit("error: %s: unable to read complete string table"%(
path,))
- if strtable[-1] != '\0':
+ if strtable[-1] != 0:
raise SystemExit("error: %s: invalid string table in headermap" % (
path,))
@@ -98,7 +98,7 @@
if idx >= len(self.strtable):
raise SystemExit("error: %s: invalid string index" % (
path,))
- end_idx = self.strtable.index('\0', idx)
+ end_idx = self.strtable.index(0, idx)
return self.strtable[idx:end_idx]
@property
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107944.365904.patch
Type: text/x-patch
Size: 1193 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210812/134fe308/attachment-0001.bin>
More information about the cfe-commits
mailing list