vim: add cmd to generate compiledb from AOSP logs

This commit is contained in:
Mathieu Maret 2023-07-18 12:17:35 +02:00
parent 9c0a8266f5
commit e633dc11b2

View File

@ -72,6 +72,15 @@ if has("cscope")
call GetCscopeDb(path) call GetCscopeDb(path)
endfunction endfunction
command! GenerateCscopeDb :call GenerateCscopeDb() command! GenerateCscopeDb :call GenerateCscopeDb()
" Open out/verbose.log.gz then run this cmd. It should produce a compile_commands.json. This is for case when SOONG variable
" Does not work (see
" https://android.googlesource.com/platform/build/soong/+/HEAD/docs/compdb.md)
function! GenerateCompileDbFromAOSP()
let @a=""
%s/\[\d*\/\d*\] \/bin\/bash -c "\(.*\)"/\=setreg('A', submatch(1), 'V')/gn
call system("compiledb ", @a)
endfunction
command! GenerateCompileDbFromAOSP :call GenerateCompileDbFromAOSP()
endif endif
" Let autotags find all cscodepeDb " Let autotags find all cscodepeDb
" LoadLocalCscopeDb " LoadLocalCscopeDb