diff options
-rw-r--r-- | contrib/YouCompleteMe/ycm_extra_conf.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/YouCompleteMe/ycm_extra_conf.py b/contrib/YouCompleteMe/ycm_extra_conf.py index 249220bb2b..65b5b29099 100644 --- a/contrib/YouCompleteMe/ycm_extra_conf.py +++ b/contrib/YouCompleteMe/ycm_extra_conf.py @@ -26,6 +26,9 @@ def GetCompilationInfoForFile(filename): if IsHeaderFile(filename): basename = os.path.splitext(filename)[0] c_file = basename + '.c' + # for pure headers (no c file), default to main.c + if not os.path.exists(c_file): + c_file = os.path.join(DirectoryOfThisScript(), 'main.c') if os.path.exists(c_file): compilation_info = database.GetCompilationInfoForFile(c_file) if compilation_info.compiler_flags_: @@ -38,7 +41,14 @@ def FlagsForFile(filename): compilation_info = GetCompilationInfoForFile(filename) if not compilation_info: return None + # Add flags not needed for clang-the-binary, + # but needed for libclang-the-library (YCM uses this last one). + flags = (list(compilation_info.compiler_flags_) + if compilation_info.compiler_flags_ + else []) + extra_flags = ['-Wno-newline-eof'] + final_flags = flags + extra_flags return { - 'flags': compilation_info.compiler_flags_, + 'flags': final_flags, 'do_cache': True } |