(filename)
| 33 | |
| 34 | |
| 35 | def GetCompilationInfoForFile(filename): |
| 36 | # The compilation_commands.json file generated by CMake does not have entries |
| 37 | # for header files. So we do our best by asking the db for flags for a |
| 38 | # corresponding source file, if any. If one exists, the flags for that file |
| 39 | # should be good enough. |
| 40 | if IsHeaderFile(filename): |
| 41 | basename = os.path.splitext(filename)[0] |
| 42 | for extension in SOURCE_EXTENSIONS: |
| 43 | replacement_file = basename + extension |
| 44 | if os.path.exists(replacement_file): |
| 45 | compilation_info = database.GetCompilationInfoForFile( |
| 46 | replacement_file) |
| 47 | if compilation_info.compiler_flags_: |
| 48 | return compilation_info |
| 49 | return None |
| 50 | return database.GetCompilationInfoForFile(filename) |
| 51 | |
| 52 | |
| 53 | # This is the entry point; this function is called by ycmd to produce flags for |
no test coverage detected