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

Function GetCompilationInfoForFile

runtime/.ycm_extra_conf.py:106–126  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

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