Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: third_party/class-dump/class-dump.py

Issue 1806523002: Add BUILD.gn rules to compile third_party/class-dump. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compiler
Patch Set: Use ${host_toolchain} instead of //build/toolchain/mac:clang_x64 Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/class-dump/class-dump.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 # Wrapper around class-dump to allow gn build to run the tool (as action
6 # target can only run python scripts). Also filters the output to remove
7 # all cxx_destruct lines that are not understood from class-dump output.
8
9 import argparse
10 import errno
11 import os
12 import subprocess
13 import sys
14
15
16 def Main(args):
17 parser = argparse.ArgumentParser('wrapper around class-dump')
18 parser.add_argument(
19 '-o', '--output', required=True,
20 help='name of the output file')
21 parser.add_argument(
22 '-t', '--class-dump-path', required=True,
23 help='path to class-dump executable')
24 parser.add_argument(
25 'args', nargs='*',
26 help='arguments to pass to class-dump')
27 args = parser.parse_args(args)
28
29 try:
30 os.makedirs(os.path.dirname(args.output))
31 except OSError, e:
32 if e.errno != errno.EEXIST:
33 raise
34
35 process = subprocess.Popen(
36 [args.class_dump_path] + args.args,
37 stdout=subprocess.PIPE,
38 stderr=subprocess.PIPE)
39 stdout, stderr = process.communicate()
40 if process.returncode != 0:
41 sys.stderr.write(stderr)
42 sys.exit(process.returncode)
43
44 with open(args.output, 'wb') as output:
45 output.write("// Treat class-dump output as a system header.\n")
46 output.write("#pragma clang system_header\n")
47 for line in stdout.splitlines():
48 if 'cxx_destruct' in line:
49 continue
50 output.write(line)
51 output.write('\n')
52
53
54 if __name__ == '__main__':
55 Main(sys.argv[1:])
OLDNEW
« no previous file with comments | « third_party/class-dump/class-dump.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698