[clang] b4c1cbf - [hmaptool] Fix string decoding for Python 3

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 3 15:18:59 PST 2022


Author: Shoaib Meenai
Date: 2022-03-03T15:18:21-08:00
New Revision: b4c1cbff79d0631c35ca2efa97bd2a47929945b8

URL: https://github.com/llvm/llvm-project/commit/b4c1cbff79d0631c35ca2efa97bd2a47929945b8
DIFF: https://github.com/llvm/llvm-project/commit/b4c1cbff79d0631c35ca2efa97bd2a47929945b8.diff

LOG: [hmaptool] Fix string decoding for Python 3

Our "strings" were actually bytes, which made verbose dumping fail.
Decode them so they actually become strings.

Reviewed By: bruno

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

Added: 
    

Modified: 
    clang/utils/hmaptool/hmaptool

Removed: 
    


################################################################################
diff  --git a/clang/utils/hmaptool/hmaptool b/clang/utils/hmaptool/hmaptool
index 73897c8bb8e9f..d7754632b162b 100755
--- a/clang/utils/hmaptool/hmaptool
+++ b/clang/utils/hmaptool/hmaptool
@@ -100,7 +100,7 @@ class HeaderMap(object):
             raise SystemExit("error: %s: invalid string index" % (
                     idx,))
         end_idx = self.strtable.index(0, idx)
-        return self.strtable[idx:end_idx]
+        return self.strtable[idx:end_idx].decode()
 
     @property
     def mappings(self):


        


More information about the cfe-commits mailing list