mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1522140 - Make .ycm_extra_conf.py handle headers better. r=Ehsan
Files with .h extension are built with the c compiler by default, which makes the diagnostics useless. If we know this is a cpp file, hint it so that it builds it with the right mode. Differential Revision: https://phabricator.services.mozilla.com/D17372 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
ad87a838f7
commit
1dcbdcf59e
@ -24,6 +24,16 @@ mach_module = imp.load_module('_mach', open(path), path, ('', 'r', imp.PY_SOURCE
|
||||
|
||||
sys.dont_write_bytecode = old_bytecode
|
||||
|
||||
def _is_likely_cpp_header(filename):
|
||||
if not filename.endswith('.h'):
|
||||
return False
|
||||
|
||||
if filename.endswith('Inlines.h') or filename.endswith('-inl.h'):
|
||||
return True
|
||||
|
||||
cpp_file = filename[:-1] + 'cpp'
|
||||
return os.path.exists(cpp_file)
|
||||
|
||||
def FlagsForFile(filename):
|
||||
mach = mach_module.get_mach()
|
||||
out = StringIO()
|
||||
@ -41,6 +51,9 @@ def FlagsForFile(filename):
|
||||
# https://github.com/Valloric/YouCompleteMe/issues/1490
|
||||
final_flags = [x for x in flag_list if not x.startswith('-march=armv')]
|
||||
|
||||
if _is_likely_cpp_header(filename):
|
||||
final_flags += ["-x", "c++"]
|
||||
|
||||
return {
|
||||
'flags': final_flags,
|
||||
'do_cache': True
|
||||
|
Loading…
Reference in New Issue
Block a user