0

Fix undefined variables in chromium.ycm_extra_conf.py

My YCM was failing due to `database` and `extension` being undefined.
It seems like the root cause is https://crrev.com/c/4392504, but the fix
is pretty clear, so initialize both variables.

Change-Id: I9a7ea4ee8d943a967bbaa05a5fcd61240229355d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4396662
Reviewed-by: Brian Geffon <bgeffon@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Daniel Rubery <drubery@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1125684}
This commit is contained in:
Daniel Rubery
2023-04-03 23:14:26 +00:00
committed by Chromium LUCI CQ
parent bca8b7b9d8
commit a0711dd3c5

@ -69,6 +69,7 @@ import ycm_core
# If the user has set the environment variable CHROMIUM_BUILD_DIR we will
# first attempt to find compilation flags in the compile-commands.json file in that
# directory first.
database = None
compilation_database_folder=os.getenv('CHROMIUM_BUILD_DIR')
if compilation_database_folder and os.path.exists(compilation_database_folder):
database = ycm_core.CompilationDatabase(compilation_database_folder)
@ -342,7 +343,7 @@ def GetClangOptionsFromNinjaForFilename(chrome_root, filename):
out_dir = GetNinjaOutputDirectory(chrome_root)
clang_line = None
buildable_extension = extension
buildable_extension = os.path.splitext(filename)[1]
for candidate in FileCompilationCandidates(filename):
clang_line = GetClangCommandLineFromNinjaForSource(out_dir, candidate)
if clang_line: