MCPcopy Create free account
hub / github.com/MegEngine/MegCC / GetCompilationInfoForFile

Function GetCompilationInfoForFile

compiler/.ycm_extra_conf.py:110–130  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

108
109
110def GetCompilationInfoForFile(filename):
111 # The compilation_commands.json file generated by CMake does not have entries
112 # for header files. So we do our best by asking the db for flags for a
113 # corresponding source file, if any. If one exists, the flags for that file
114 # should be good enough.
115 if IsHeaderFile(filename):
116 basename = os.path.splitext(filename)[0]
117 for extension in SOURCE_EXTENSIONS:
118 replacement_file = basename + extension
119 if os.path.exists(replacement_file):
120 compilation_info = database.GetCompilationInfoForFile(
121 replacement_file)
122 if compilation_info.compiler_flags_:
123 return compilation_info
124 # infact include file always do not locate at the src dir
125 # so this always return None, what`s more, new clangd can handle
126 # CMake database which do not have entries for header files
127 # so now we compat it, the None status will be handled at
128 # FlagsForFile function
129 # return None
130 return database.GetCompilationInfoForFile(filename)
131
132
133# This is the entry point; this function is called by ycmd to produce flags for

Callers 1

FlagsForFileFunction · 0.70

Calls 1

IsHeaderFileFunction · 0.70

Tested by

no test coverage detected