Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import json
- import subprocess
- import sys
- def run(cmd):
- # print(cmd)
- stringCmd = u" ".join(cmd)
- subprocess.call(stringCmd, shell=True)
- def runIWYUGDB(wd, args):
- cmd =[u"gdb", u"--args"]
- cmd.extend(basecmd)
- cmd.extend(args)
- run(cmd)
- def runIWYU(wd, args):
- cmd = basecmd[:]
- cmd.extend(args)
- run(cmd)
- f = open("compile_commands.json", "r")
- tunits = json.load(f)
- extraArg = u" ".join([u"-Xiwyu " + x for x in sys.argv[1:]])
- basedir = u"/home/rpavlik/llvm-trunk/"
- basecmd = [basedir + u"bin/include-what-you-use", u"-Xiwyu", u"--verbose=2", extraArg] # "-working-directory", wd]
- srcdir = "/home/rpavlik/src/third-party/llvm/tools/clang/tools/include-what-you-use/"
- mappingFiles = ["gcc.libc.imp", "gcc.stl.headers.imp", "gcc.symbols.imp", "google.imp", "third_party.imp"] # "iwyu.gcc.imp"
- for mapping in mappingFiles:
- basecmd.extend(["-Xiwyu", "--mapping_file="+srcdir+mapping])
- for tu in tunits:
- oldDriver = tu["command"].split(None)[0]
- cmd = tu["command"].replace(oldDriver, u"")
- runIWYU(tu["directory"], [cmd])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement