llvm_opt_wrapper.py 697 B

12345678910111213141516171819202122232425
  1. import subprocess
  2. import sys
  3. def fix(s):
  4. # we use '#' instead of ',' because ymake always splits args by comma
  5. if s.startswith('-internalize-public-api-list'):
  6. return s.replace('#', ',')
  7. # Dirty hack to eliminate double quotes from value of passes option.
  8. # Note that these double quoted are required by cmake.
  9. if s.startswith('-passes'):
  10. name, value = s.split('=', 1)
  11. value = value.strip('"')
  12. return '='.join([name, value])
  13. return s
  14. if __name__ == '__main__':
  15. path = sys.argv[1]
  16. args = [fix(s) for s in [path] + sys.argv[2:]]
  17. rc = subprocess.call(args, shell=False, stderr=sys.stderr, stdout=sys.stdout)
  18. sys.exit(rc)