endif
enddef
+export def FTll()
+ if getline(1) =~ ';\|\<source_filename\>\|\<target\>'
+ setf llvm
+ else
+ setf lifelines
+ endif
+enddef
+
export def FTlpc()
if exists("g:lpc_syntax_for_c")
var lnum = 1
au BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rc setf lftp
" Lifelines (or Lex for C++!)
-au BufNewFile,BufRead *.ll setf lifelines
+au BufNewFile,BufRead *.ll call dist#ft#FTll()
" Lilo: Linux loader
au BufNewFile,BufRead lilo.conf setf lilo
--- /dev/null
+" Vim filetype plugin file
+" Language: LLVM IR
+" Last Change: 2024 Oct 22
+" Maintainer: Wu, Zhenyu <wuzhenyu@ustc.edu>
+
+if exists("b:did_ftplugin") | finish | endif
+let b:did_ftplugin = 1
+
+setl comments=:;
+setl commentstring=;\ %s
+
+let b:undo_ftplugin = "setl commentstring< comments<"
filetype off
endfunc
+func Test_ll_file()
+ filetype on
+
+ " LLVM IR
+ call writefile(['target triple = "nvptx64-nvidia-cuda"'], 'Xfile.ll', 'D')
+ split Xfile.ll
+ call assert_equal('llvm', &filetype)
+ bwipe!
+
+ " lifelines
+ call writefile(['proc main() {}'], 'Xfile.ll', 'D')
+ split Xfile.ll
+ call assert_equal('lifelines', &filetype)
+ bwipe!
+
+ filetype off
+endfunc
+
func Test_lsl_file()
filetype on
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 866,
/**/
865,
/**/