OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # Autocompletion config for YouCompleteMe in Chromium. | 5 # Autocompletion config for YouCompleteMe in Chromium. |
6 # | 6 # |
7 # USAGE: | 7 # USAGE: |
8 # | 8 # |
9 # 1. Install YCM [https://github.com/Valloric/YouCompleteMe] | 9 # 1. Install YCM [https://github.com/Valloric/YouCompleteMe] |
10 # (Googlers should check out [go/ycm]) | 10 # (Googlers should check out [go/ycm]) |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 Returns: | 123 Returns: |
124 (List of Strings) Command line arguments for clang. | 124 (List of Strings) Command line arguments for clang. |
125 """ | 125 """ |
126 if not chrome_root: | 126 if not chrome_root: |
127 return [] | 127 return [] |
128 | 128 |
129 # Generally, everyone benefits from including Chromium's src/, because all of | 129 # Generally, everyone benefits from including Chromium's src/, because all of |
130 # Chromium's includes are relative to that. | 130 # Chromium's includes are relative to that. |
131 chrome_flags = ['-I' + os.path.join(chrome_root)] | 131 chrome_flags = ['-I' + os.path.join(chrome_root)] |
132 | 132 |
| 133 # Version of Clang used to compile Chromium can be newer then version of |
| 134 # libclang that YCM uses for completion. So it's possible that YCM's libclang |
| 135 # doesn't know about some used warning options, which causes compilation |
| 136 # warnings (and errors, because of '-Werror'); |
| 137 chrome_flags.append('-Wno-unknown-warning-option') |
| 138 |
133 # Default file to get a reasonable approximation of the flags for a Blink | 139 # Default file to get a reasonable approximation of the flags for a Blink |
134 # file. | 140 # file. |
135 blink_root = os.path.join(chrome_root, 'third_party', 'WebKit') | 141 blink_root = os.path.join(chrome_root, 'third_party', 'WebKit') |
136 default_blink_file = os.path.join(blink_root, 'Source', 'core', 'Init.cpp') | 142 default_blink_file = os.path.join(blink_root, 'Source', 'core', 'Init.cpp') |
137 | 143 |
138 # Header files can't be built. Instead, try to match a header file to its | 144 # Header files can't be built. Instead, try to match a header file to its |
139 # corresponding source file. | 145 # corresponding source file. |
140 if filename.endswith('.h'): | 146 if filename.endswith('.h'): |
141 # Add config.h to Blink headers, which won't have it by default. | 147 # Add config.h to Blink headers, which won't have it by default. |
142 if filename.startswith(blink_root): | 148 if filename.startswith(blink_root): |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 """ | 225 """ |
220 chrome_root = FindChromeSrcFromFilename(filename) | 226 chrome_root = FindChromeSrcFromFilename(filename) |
221 chrome_flags = GetClangCommandFromNinjaForFilename(chrome_root, | 227 chrome_flags = GetClangCommandFromNinjaForFilename(chrome_root, |
222 filename) | 228 filename) |
223 final_flags = flags + chrome_flags | 229 final_flags = flags + chrome_flags |
224 | 230 |
225 return { | 231 return { |
226 'flags': final_flags, | 232 'flags': final_flags, |
227 'do_cache': True | 233 'do_cache': True |
228 } | 234 } |
OLD | NEW |