12 '-fno-strict-aliasing',
21 '-isystem',
'/usr/include',
22 '-isystem',
'/usr/local/include',
32 compilation_database_folder =
''
34 if os.path.exists( compilation_database_folder ):
35 database = ycm_core.CompilationDatabase( compilation_database_folder )
39 SOURCE_EXTENSIONS = [
'.cc' ]
42 return os.path.dirname( os.path.abspath( __file__ ) )
46 if not working_directory:
49 make_next_absolute =
False
50 path_flags = [
'-isystem',
'-I',
'-iquote',
'--sysroot=' ]
54 if make_next_absolute:
55 make_next_absolute =
False
56 if not flag.startswith(
'/' ):
57 new_flag = os.path.join( working_directory, flag )
59 for path_flag
in path_flags:
61 make_next_absolute =
True
64 if flag.startswith( path_flag ):
65 path = flag[
len( path_flag ): ]
66 new_flag = path_flag + os.path.join( working_directory, path )
70 new_flags.append( new_flag )
75 extension = os.path.splitext( filename )[ 1 ]
76 return extension
in [
'.h',
'.hxx',
'.hpp',
'.hh' ]
85 basename = os.path.splitext( filename )[ 0 ]
86 for extension
in SOURCE_EXTENSIONS:
87 replacement_file = basename + extension
88 if os.path.exists( replacement_file ):
89 compilation_info = database.GetCompilationInfoForFile(
91 if compilation_info.compiler_flags_:
92 return compilation_info
94 return database.GetCompilationInfoForFile( filename )
102 if not compilation_info:
106 compilation_info.compiler_flags_,
107 compilation_info.compiler_working_dir_ )
113 'flags': final_flags,