From 4f72023e16fab3d7df53e3b1acea87ccb58be90b Mon Sep 17 00:00:00 2001 From: David VandeBunte Date: Sun, 6 Jan 2019 20:17:32 -0600 Subject: bugfix: c.vim: Pull build directory from compilation database The LLVM compiler database JSON already includes a directory where the build was performed: https://clang.llvm.org/docs/JSONCompilationDatabase.html Prefer this directory for fixing relative paths in compiler include arguments in ale#c#ParseCFlags. Without this change, users cannot create a symlink to their compilation database as suggested in the LLVM tooling setup instructions: https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html --- test/test_c_flag_parsing.vader | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/test_c_flag_parsing.vader') diff --git a/test/test_c_flag_parsing.vader b/test/test_c_flag_parsing.vader index 4c23c711..b187ffec 100644 --- a/test/test_c_flag_parsing.vader +++ b/test/test_c_flag_parsing.vader @@ -161,14 +161,14 @@ Execute(FlagsFromCompileCommands should tolerate empty values): AssertEqual '', ale#c#FlagsFromCompileCommands(bufnr(''), '') Execute(ParseCompileCommandsFlags should tolerate empty values): - AssertEqual '', ale#c#ParseCompileCommandsFlags(bufnr(''), '', {}, {}) + AssertEqual '', ale#c#ParseCompileCommandsFlags(bufnr(''), {}, {}) Execute(ParseCompileCommandsFlags should parse some basic flags): noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c')) AssertEqual \ '-I' . ale#path#Simplify('/usr/include/xmms2'), - \ ale#c#ParseCompileCommandsFlags(bufnr(''), ale#path#Simplify('/foo/bar/xmms2-mpris'), { "xmms2-mpris.c": [ + \ ale#c#ParseCompileCommandsFlags(bufnr(''), { "xmms2-mpris.c": [ \ { \ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'), \ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2') @@ -183,7 +183,7 @@ Execute(ParseCompileCommandsFlags should fall back to files in the same director AssertEqual \ '-I' . ale#path#Simplify('/usr/include/xmms2'), - \ ale#c#ParseCompileCommandsFlags(bufnr(''), ale#path#Simplify('/foo/bar/xmms2-mpris'), {}, { "src": [ + \ ale#c#ParseCompileCommandsFlags(bufnr(''), {}, { "src": [ \ { \ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'), \ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2') -- cgit v1.2.3