(filename)
| 104 | return extension in [ '.h', '.hxx', '.hpp', '.hh' ] |
| 105 | |
| 106 | def 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 | return None |
| 121 | return database.GetCompilationInfoForFile(filename) |
| 122 | |
| 123 | |
| 124 | def FlagsForFile( filename, **kwargs ): |
no test coverage detected