aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/llvm_opt_wrapper.py
blob: 90bd87f97a8edeb87eac18501f04b4e183b62fa6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import subprocess
import sys


def fix(s):
    # we use '#' instead of ',' because ymake always splits args by comma
    if s.startswith('-internalize-public-api-list'):
        return s.replace('#', ',')

    # Dirty hack to eliminate double quotes from value of passes option.
    # Note that these double quoted are required by cmake.
    if s.startswith('-passes'):
        name, value = s.split('=', 1)
        value = value.strip('"')
        return '='.join([name, value])

    return s


if __name__ == '__main__':
    path = sys.argv[1]
    args = [fix(s) for s in [path] + sys.argv[2:]]

    rc = subprocess.call(args, shell=False, stderr=sys.stderr, stdout=sys.stdout)
    sys.exit(rc)