(filename)
| 122 | |
| 123 | |
| 124 | def GetCompilationInfoForFile(filename): |
| 125 | # The compilation_commands.json file generated by CMake does not have entries |
| 126 | # for header files. So we do our best by asking the db for flags for a |
| 127 | # corresponding source file, if any. If one exists, the flags for that file |
| 128 | # should be good enough. |
| 129 | if IsHeaderFile(filename): |
| 130 | for alternative in PotentialAlternatives(filename): |
| 131 | if os.path.exists(alternative): |
| 132 | compilation_info = database.GetCompilationInfoForFile( |
| 133 | alternative |
| 134 | ) |
| 135 | |
| 136 | if compilation_info.compiler_flags_: |
| 137 | return compilation_info |
| 138 | return None |
| 139 | else: |
| 140 | return database.GetCompilationInfoForFile(filename) |
| 141 | |
| 142 | |
| 143 | def FlagsForFile(filename, **kwargs): |
no test coverage detected