Now explicitly adding the clang includes to flags

This commit is contained in:
Strahinja Val Markovic 2013-01-17 17:08:28 -08:00
parent 0922864eda
commit f9a516704b

View File

@ -31,6 +31,7 @@ class Flags( object ):
self.flags_for_file = {} self.flags_for_file = {}
self.flags_module_for_file = {} self.flags_module_for_file = {}
self.flags_module_for_flags_module_file = {} self.flags_module_for_flags_module_file = {}
self.special_clang_flags = _SpecialClangIncludes()
def FlagsForFile( self, filename ): def FlagsForFile( self, filename ):
@ -42,6 +43,7 @@ class Flags( object ):
return ycm_core.StringVec() return ycm_core.StringVec()
results = flags_module.FlagsForFile( filename ) results = flags_module.FlagsForFile( filename )
results[ 'flags' ] += self.special_clang_flags
sanitized_flags = _SanitizeFlags( results[ 'flags' ] ) sanitized_flags = _SanitizeFlags( results[ 'flags' ] )
if results[ 'do_cache' ]: if results[ 'do_cache' ]:
@ -69,6 +71,7 @@ class Flags( object ):
return flags_module return flags_module
def _FlagsModuleSourceFileForFile( filename ): def _FlagsModuleSourceFileForFile( filename ):
"""For a given filename, finds its nearest CLANG_OPTIONS_FILENAME file that """For a given filename, finds its nearest CLANG_OPTIONS_FILENAME file that
will compute the flags necessary to compile the file. Returns None if no will compute the flags necessary to compile the file. Returns None if no
@ -116,3 +119,9 @@ def _SanitizeFlags( flags ):
for flag in sanitized_flags: for flag in sanitized_flags:
vector.append( flag ) vector.append( flag )
return vector return vector
def _SpecialClangIncludes():
libclang_dir = os.path.dirname( ycm_core.__file__ )
path_to_includes = os.path.join( libclang_dir, 'clang_includes' )
return [ '-I', path_to_includes ]