def FlagsForFile( filename ): if database: # Bear in mind that compilation_info.compiler_flags_ does NOT return a # python list, but a "list-like" StringVec object compilation_info = database.GetCompilationInfoForFile( filename ) final_flags = PrepareClangFlags( MakeRelativePathsInFlagsAbsolute( compilation_info.compiler_flags_, compilation_info.compiler_working_dir_ ), filename ) # NOTE: This is just for YouCompleteMe; it's highly likely that your project # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR # ycm_extra_conf IF YOU'RE NOT 100% YOU NEED IT. try: final_flags.remove( '-stdlib=libc++' ) except ValueError: pass else: relative_to = DirectoryOfThisScript() final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to ) return { 'flags': final_flags, 'do_cache': True }
def FlagsForFile(filename): if database: # Bear in mind that compilation_info.compiler_flags_ does NOT return a # python list, but a "list-like" StringVec object compilation_info = database.GetCompilationInfoForFile(filename) final_flags = PrepareClangFlags( MakeRelativePathsInFlagsAbsolute(compilation_info.compiler_flags_, compilation_info.compiler_working_dir_), filename, ) # NOTE: This is just for YouCompleteMe; it's highly likely that your project # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR # ycm_extra_conf IF YOU'RE NOT 100% YOU NEED IT. try: final_flags.remove("-stdlib=libc++") except ValueError: pass else: relative_to = DirectoryOfThisScript() # not handling double path delimiters... if filename.startswith(relative_to): subdir = filename[len(relative_to) :].split("/")[1] else: subdir = None final_flags = MakeRelativePathsInFlagsAbsolute(flags, relative_to, subdir) return {"flags": final_flags, "do_cache": True}
def FlagsForFile(filename): if database: # Bear in mind that compilation_info.compiler_flags_ does NOT return a # python list, but a "list-like" StringVec object compilation_info = database.GetCompilationInfoForFile(filename) final_flags = PrepareClangFlags( MakeRelativePathsInFlagsAbsolute( compilation_info.compiler_flags_, compilation_info.compiler_working_dir_), filename) relative_to = DirectoryOfThisScript() final_flags.extend(MakeRelativePathsInFlagsAbsolute( flags, relative_to)) else: relative_to = DirectoryOfThisScript() final_flags = MakeRelativePathsInFlagsAbsolute(flags, relative_to) return {'flags': final_flags, 'do_cache': True}
def FlagsForFile(filename, **kwargs): if database: # Bear in mind that compilation_info.compiler_flags_ does NOT return a # python list, but a "list-like" StringVec object compilation_info = GetCompilationInfoForFile(filename) _flags = get_default_flags( ) if not compilation_info or not compilation_info.compiler_flags_ else compilation_info.compiler_flags_ _dir = compilation_info.compiler_working_dir_ if compilation_info else DirectoryOfThisScript( ) final_flags = PrepareClangFlags( MakeRelativePathsInFlagsAbsolute(_flags, _dir), filename) else: relative_to = DirectoryOfThisScript() final_flags = PrepareClangFlags( MakeRelativePathsInFlagsAbsolute(flags, relative_to), filename) return {'flags': final_flags, 'do_cache': True}
def FlagsForFile(filename): if database: # Bear in mind that compilation_info.compiler_flags_ does NOT return a # python list, but a "list-like" StringVec object compilation_info = database.GetCompilationInfoForFile(filename) final_flags = PrepareClangFlags( MakeRelativePathsInFlagsAbsolute( compilation_info.compiler_flags_, compilation_info.compiler_working_dir_), filename) relative_to = DirectoryOfThisScript() final_flags.extend(MakeRelativePathsInFlagsAbsolute(flags, relative_to)) else: relative_to = DirectoryOfThisScript() final_flags = MakeRelativePathsInFlagsAbsolute(flags, relative_to) return { 'flags': final_flags, 'do_cache': True}
def FlagsForFile(filename): if database: compilation_info = database.GetCompilationInfoForFile(filename) final_flags = PrepareClangFlags(MakeRelativePathsInFlagsAbsolute( compilation_info.compiler_flags_, compilation_info.compiler_working_dir_), filename) else: relative_to = DirectoryOfThisScript() final_flags = MakeRelativePathsInFlagsAbsolute(flags, relative_to) return {'flags': final_flags, 'do_cache': True}
def OutputForCompilationInfo(compilation_info, fudged_filename, original_filename): flags = RemoveFilenameIfPresent( PrepareClangFlags( MakeRelativePathsInFlagsAbsolute( compilation_info.compiler_flags_, compilation_info.compiler_working_dir_), fudged_filename), fudged_filename, original_filename) do_cache = bool(flags) if do_cache: flags = AddExtraFlags(flags, fudged_filename) return {'flags': flags, 'do_cache': do_cache}
def FlagsForFile(filename, **kwargs): # Bear in mind that compilation_info.compiler_flags_ does NOT return a # python list, but a "list-like" StringVec object compilation_info = GetCompilationInfoForFile(filename) if not compilation_info: relative_to = current_dir() final_flags = MakeRelativePathsInFlagsAbsolute(FLAGS, relative_to) else: final_flags = MakeRelativePathsInFlagsAbsolute( compilation_info.compiler_flags_, compilation_info.compiler_working_dir_) return { 'flags': PrepareClangFlags(final_flags, filename), 'do_cache': True }
def FlagsForFile(filename): if database: # Bear in mind that compilation_info.compiler_flags_ does NOT return a # python list, but a "list-like" StringVec object compilation_info = database.GetCompilationInfoForFile(filename) final_flags = PrepareClangFlags( MakeRelativePathsInFlagsAbsolute( compilation_info.compiler_flags_, compilation_info.compiler_working_dir_), filename) do_cache = True else: final_flags = [] do_cache = False return {'flags': final_flags, 'do_cache': do_cache}
def FlagsForFile(filename, **kwargs): final_flags = default_flags if database: # Bear in mind that compilation_info.compiler_flags_ does NOT return a # python list, but a "list-like" StringVec object compilation_info = GetCompilationInfoForFile(filename) if compilation_info: final_flags = PrepareClangFlags( MakeRelativePathsInFlagsAbsolute( compilation_info.compiler_flags_, compilation_info.compiler_working_dir_), filename) # python is a little bit special... ;-) # see http://stackoverflow.com/a/2104348 clean_flags = [x for x in final_flags if x not in to_be_removed_flags] return {'flags': mandatory_flags + clean_flags, 'do_cache': True}
def FlagsForFile(filename): if database and False: # Bear in mind that compilation_info.compiler_flags_ does NOT return a # python list, but a "list-like" StringVec object compilation_info = database.GetCompilationInfoForFile(filename) final_flags = PrepareClangFlags( MakeRelativePathsInFlagsAbsolute( compilation_info.compiler_flags_, compilation_info.compiler_working_dir_), filename) else: if filename.endswith('.c'): final_flags = c_flags else: final_flags = GetPlinkFlags() + cpp_flags # with open("flags", 'w') as flagsFile: # flagsFile.write('\n'.join(final_flags)) return {'flags': final_flags, 'do_cache': True}
def flags_for_file(self, filename): additional_flags = [] source, extra_flags = find_source_for_header(filename) compilation_info = self._db.GetCompilationInfoForFile(source) if not compilation_info.compiler_flags_: compilation_info, additional_flags = self.flags_for_default_file() additional_flags.extend( self.relative_to_absolute(self._flags, self._project_path)) flags = PrepareClangFlags( self.relative_to_absolute(compilation_info.compiler_flags_, compilation_info.compiler_working_dir_), source) return { 'flags': flags + additional_flags + extra_flags, 'do_cache': True }