OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # This script returns the flags that should be passed to clang. | 6 # This script returns the flags that should be passed to clang. |
7 | 7 |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 | 10 |
11 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) | 11 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) |
12 SRC_DIR = os.path.join(THIS_DIR, '..', '..', '..') | 12 SRC_DIR = os.path.join(THIS_DIR, '..', '..', '..') |
13 CLANG_LIB_PATH = os.path.normpath(os.path.join( | 13 CLANG_LIB_PATH = os.path.normpath(os.path.join( |
14 SRC_DIR, 'third_party', 'llvm-build', 'Release+Asserts', 'lib')) | 14 SRC_DIR, 'third_party', 'llvm-build', 'Release+Asserts', 'lib')) |
15 | 15 |
16 FLAGS = '-Xclang -add-plugin -Xclang blink-gc-plugin' | 16 FLAGS = '-Xclang -add-plugin -Xclang blink-gc-plugin' |
17 PREFIX= ' -Xclang -plugin-arg-blink-gc-plugin -Xclang ' | 17 PREFIX= ' -Xclang -plugin-arg-blink-gc-plugin -Xclang ' |
18 | 18 |
19 warn_raw_pointers = None | |
20 for arg in sys.argv[1:]: | 19 for arg in sys.argv[1:]: |
21 if arg == 'enable-oilpan=1': | 20 if arg == 'dump-graph=1': |
22 FLAGS += PREFIX + 'enable-oilpan' | |
23 if warn_raw_pointers is None: | |
24 warn_raw_pointers = True | |
25 elif arg == 'dump-graph=1': | |
26 FLAGS += PREFIX + 'dump-graph' | 21 FLAGS += PREFIX + 'dump-graph' |
27 elif arg == 'warn-raw-ptr=1': | |
28 warn_raw_pointers = True | |
29 elif arg == 'warn-raw-ptr=0': | |
30 warn_raw_pointers = False | |
31 elif arg == 'warn-unneeded-finalizer=1': | 22 elif arg == 'warn-unneeded-finalizer=1': |
sof
2016/04/29 07:19:29
After the next roll, it is now an option to defaul
| |
32 FLAGS += PREFIX + 'warn-unneeded-finalizer' | 23 FLAGS += PREFIX + 'warn-unneeded-finalizer' |
33 elif arg.startswith('custom_clang_lib_path='): | 24 elif arg.startswith('custom_clang_lib_path='): |
34 CLANG_LIB_PATH = arg[len('custom_clang_lib_path='):] | 25 CLANG_LIB_PATH = arg[len('custom_clang_lib_path='):] |
35 | 26 |
36 if warn_raw_pointers is True: | |
37 FLAGS += PREFIX + 'warn-raw-ptr' | |
38 | |
39 if not sys.platform in ['win32', 'cygwin']: | 27 if not sys.platform in ['win32', 'cygwin']: |
40 LIBSUFFIX = 'dylib' if sys.platform == 'darwin' else 'so' | 28 LIBSUFFIX = 'dylib' if sys.platform == 'darwin' else 'so' |
41 FLAGS = ('-Xclang -load -Xclang "%s/libBlinkGCPlugin.%s" ' + FLAGS) % \ | 29 FLAGS = ('-Xclang -load -Xclang "%s/libBlinkGCPlugin.%s" ' + FLAGS) % \ |
42 (CLANG_LIB_PATH, LIBSUFFIX) | 30 (CLANG_LIB_PATH, LIBSUFFIX) |
43 | 31 |
44 print FLAGS | 32 print FLAGS |
OLD | NEW |