[opt viewer] Python compat - decode/encode string
authorYuanfang Chen <yuanfang.chen@sony.com>
Mon, 20 Jan 2020 01:52:08 +0000 (17:52 -0800)
committerYuanfang Chen <yuanfang.chen@sony.com>
Wed, 29 Jan 2020 22:49:24 +0000 (14:49 -0800)
commit43d9f2d1e8ae2765c1fc02b7cf757c9c05761ac0
tree0f7cf7868b27bcccf144996b8d6d66dca5d16b00
parent91aa67bf290bc7f877b1b90128284863bc31aa43
[opt viewer] Python compat - decode/encode string

Summary:
Use io.open instead of codecs.open according to here
https://stackoverflow.com/questions/10971033/backporting-python-3-openencoding-utf-8-to-python-2

Add `u` prefix to string literal to make them utf-8 in python2.

Reviewers: anemet, serge-sans-paille

Reviewed by: serge-sans-paille

Differential Revision: https://reviews.llvm.org/D73011
llvm/tools/opt-viewer/opt-viewer.py
llvm/tools/opt-viewer/optrecord.py