Commit d4a4d285 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

Fix ycm config for headers without source

Instead of using hard-coded clang flags (which are missing important
flags and are thus not that useful), use the flags for some unrelated
C++ file.

R=ahaas@chromium.org

No-Try: true
Change-Id: I516df9431e8aad1a63e832aa28450475193fd404
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1955549
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65387}
parent c6742529
......@@ -103,27 +103,16 @@ def GetClangCommandFromNinjaForFilename(v8_root, filename):
# Header files can't be built. Instead, try to match a header file to its
# corresponding source file.
if filename.endswith('.h'):
alternates = ['.cc', '.cpp']
for alt_extension in alternates:
alt_name = filename[:-2] + alt_extension
if os.path.exists(alt_name):
filename = alt_name
base = filename[:-6] if filename.endswith('-inl.h') else filename[:-2]
for alternate in [base + e for e in ['.cc', '.cpp']]:
if os.path.exists(alternate):
filename = alternate
break
else:
if filename.endswith('-inl.h'):
for alt_extension in alternates:
alt_name = filename[:-6] + alt_extension
if os.path.exists(alt_name):
filename = alt_name
break;
else:
# If this is a standalone -inl.h file with no source, the best we can
# do is try to use the default flags.
return v8_flags
else:
# If this is a standalone .h file with no source, the best we can do is
# try to use the default flags.
return v8_flags
# If this is a standalone .h file with no source, we ask ninja for the
# compile flags of some generic cc file ('src/utils/utils.cc'). This
# should contain most/all of the interesting flags for other targets too.
filename = os.path.join(v8_root, 'src', 'utils', 'utils.cc')
sys.path.append(os.path.join(v8_root, 'tools', 'ninja'))
from ninja_output import GetNinjaOutputDirectory
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment