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 <[email protected]>
Reviewed-by: Ɓukasz Anforowicz <[email protected]>
Commit-Queue: Daniel Rubery <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1125684}
NOKEYCHECK=True
GitOrigin-RevId: a0711dd3c5e46dec60123e02dba74fc618a8f284
diff --git a/chromium.ycm_extra_conf.py b/chromium.ycm_extra_conf.py
index b5dca44..5bf34a2 100644
--- a/chromium.ycm_extra_conf.py
+++ b/chromium.ycm_extra_conf.py
@@ -69,6 +69,7 @@
 # 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 @@
   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: