Imported Upstream version 5.18.0.167

Former-commit-id: 289509151e0fee68a1b591a20c9f109c3c789d3a
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-10-20 08:25:10 +00:00
parent e19d552987
commit b084638f15
28489 changed files with 184 additions and 3866856 deletions

View File

@ -1,22 +0,0 @@
-*- llvm/utils/vim/README -*-
This directory contains settings for the vim editor to work on llvm *.ll and
tablegen *.td files. It comes with filetype detection rules in the (ftdetect),
syntax highlighting (syntax), some minimal sensible default settings (ftplugin)
and indentation plugins (indent).
To install copy all subdirectories to your $HOME/.vim or if you prefer create
symlinks to the files here. Do not copy the vimrc file here it is only meant as an inspiration and starting point for those working on llvm c++ code.
Note: If you notice missing or incorrect syntax highlighting, please contact
<llvm-bugs [at] lists.llvm.org>; if you wish to provide a patch to improve the
functionality, it will be most appreciated. Thank you.
If you find yourself working with LLVM Makefiles often, but you don't get syntax
highlighting (because the files have names such as Makefile.rules or
TEST.nightly.Makefile), add the following to your ~/.vimrc:
" LLVM Makefile highlighting mode
augroup filetype
au! BufRead,BufNewFile *Makefile* set filetype=make
augroup END

View File

@ -1 +0,0 @@
au BufRead,BufNewFile lit.*cfg set filetype=python

View File

@ -1 +0,0 @@
au BufRead,BufNewFile *.ll set filetype=llvm

View File

@ -1 +0,0 @@
au BufRead,BufNewFile *.td set filetype=tablegen

View File

@ -1,12 +0,0 @@
" Vim filetype plugin file
" Language: LLVM Assembly
" Maintainer: The LLVM team, http://llvm.org/
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
setlocal softtabstop=2 shiftwidth=2
setlocal expandtab
setlocal comments+=:;

View File

@ -1,12 +0,0 @@
" Vim filetype plugin file
" Language: LLVM TableGen
" Maintainer: The LLVM team, http://llvm.org/
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
setlocal matchpairs+=<:>
setlocal softtabstop=2 shiftwidth=2
setlocal expandtab

View File

@ -1,72 +0,0 @@
" Vim indent file
" Language: llvm
" Maintainer: The LLVM team, http://llvm.org/
" What this indent plugin currently does:
" - If no other rule matches copy indent from previous non-empty,
" non-commented line
" - On '}' align the same as the line containing the matching '{'
" - If previous line ends with ':' increase indentation
" - If the current line ends with ':' indent at the same level as the
" enclosing '{'/'}' block
" Stuff that would be nice to add:
" - Continue comments on next line
" - If there is an opening+unclosed parenthesis on previous line indent to that
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal shiftwidth=2 expandtab
setlocal indentkeys=0{,0},<:>,!^F,o,O,e
setlocal indentexpr=GetLLVMIndent()
if exists("*GetLLVMIndent")
finish
endif
function! FindOpenBrace(lnum)
call cursor(a:lnum, 1)
return searchpair('{', '', '}', 'bW')
endfun
function! GetLLVMIndent()
" On '}' align the same as the line containing the matching '{'
let thisline = getline(v:lnum)
if thisline =~ '^\s*}'
call cursor(v:lnum, 1)
silent normal %
let opening_lnum = line('.')
if opening_lnum != v:lnum
return indent(opening_lnum)
endif
endif
" Indent labels the same as the current opening block
if thisline =~ ':\s*$'
let blockbegin = FindOpenBrace(v:lnum)
if blockbegin > 0
return indent(blockbegin)
endif
endif
" Find a non-blank not-completely commented line above the current line.
let prev_lnum = prevnonblank(v:lnum - 1)
while prev_lnum > 0 && synIDattr(synID(prev_lnum, indent(prev_lnum)+1, 0), "name") =? "string\|comment"
let prev_lnum = prevnonblank(prev_lnum-1)
endwhile
" Hit the start of the file, use zero indent.
if prev_lnum == 0
return 0
endif
let ind = indent(prev_lnum)
let prevline = getline(prev_lnum)
" Add a 'shiftwidth' after lines that start a block or labels
if prevline =~ '{\s*$' || prevline =~ ':\s*$'
let ind = ind + &shiftwidth
endif
return ind
endfunction

View File

@ -1,230 +0,0 @@
" Vim syntax file
" Language: llvm
" Maintainer: The LLVM team, http://llvm.org/
" Version: $Revision$
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn case match
" Types.
" Types also include struct, array, vector, etc. but these don't
" benefit as much from having dedicated highlighting rules.
syn keyword llvmType void half float double x86_fp80 fp128 ppc_fp128
syn keyword llvmType label metadata x86_mmx
syn keyword llvmType type label opaque token
syn match llvmType /\<i\d\+\>/
" Instructions.
" The true and false tokens can be used for comparison opcodes, but it's
" much more common for these tokens to be used for boolean constants.
syn keyword llvmStatement add addrspacecast alloca and arcp ashr atomicrmw
syn keyword llvmStatement bitcast br catchpad catchswitch catchret call
syn keyword llvmStatement cleanuppad cleanupret cmpxchg eq exact extractelement
syn keyword llvmStatement extractvalue fadd fast fcmp fdiv fence fmul fpext
syn keyword llvmStatement fptosi fptoui fptrunc free frem fsub getelementptr
syn keyword llvmStatement icmp inbounds indirectbr insertelement insertvalue
syn keyword llvmStatement inttoptr invoke landingpad load lshr malloc max min
syn keyword llvmStatement mul nand ne ninf nnan nsw nsz nuw oeq oge ogt ole
syn keyword llvmStatement olt one or ord phi ptrtoint resume ret sdiv select
syn keyword llvmStatement sext sge sgt shl shufflevector sitofp sle slt srem
syn keyword llvmStatement store sub switch trunc udiv ueq uge ugt uitofp ule ult
syn keyword llvmStatement umax umin une uno unreachable unwind urem va_arg
syn keyword llvmStatement xchg xor zext
" Keywords.
syn keyword llvmKeyword
\ acq_rel
\ acquire
\ addrspace
\ alias
\ align
\ alignstack
\ alwaysinline
\ appending
\ argmemonly
\ arm_aapcscc
\ arm_aapcs_vfpcc
\ arm_apcscc
\ asm
\ atomic
\ available_externally
\ blockaddress
\ builtin
\ byval
\ c
\ catch
\ caller
\ cc
\ ccc
\ cleanup
\ coldcc
\ comdat
\ common
\ constant
\ datalayout
\ declare
\ default
\ define
\ deplibs
\ dereferenceable
\ distinct
\ dllexport
\ dllimport
\ except
\ external
\ externally_initialized
\ extern_weak
\ fastcc
\ filter
\ from
\ gc
\ global
\ hhvmcc
\ hhvm_ccc
\ hidden
\ initialexec
\ inlinehint
\ inreg
\ inteldialect
\ intel_ocl_bicc
\ internal
\ linkonce
\ linkonce_odr
\ localdynamic
\ localexec
\ local_unnamed_addr
\ minsize
\ module
\ monotonic
\ msp430_intrcc
\ musttail
\ naked
\ nest
\ noalias
\ nobuiltin
\ nocapture
\ noimplicitfloat
\ noinline
\ nonlazybind
\ nonnull
\ norecurse
\ noredzone
\ noreturn
\ nounwind
\ optnone
\ optsize
\ personality
\ private
\ protected
\ ptx_device
\ ptx_kernel
\ readnone
\ readonly
\ release
\ returned
\ returns_twice
\ sanitize_address
\ sanitize_memory
\ sanitize_thread
\ section
\ seq_cst
\ sideeffect
\ signext
\ singlethread
\ source_filename
\ speculatable
\ spir_func
\ spir_kernel
\ sret
\ ssp
\ sspreq
\ sspstrong
\ strictfp
\ swiftcc
\ tail
\ target
\ thread_local
\ to
\ triple
\ unnamed_addr
\ unordered
\ uselistorder
\ uselistorder_bb
\ uwtable
\ volatile
\ weak
\ weak_odr
\ within
\ writeonly
\ x86_64_sysvcc
\ win64cc
\ x86_fastcallcc
\ x86_stdcallcc
\ x86_thiscallcc
\ zeroext
" Obsolete keywords.
syn keyword llvmError getresult begin end
" Misc syntax.
syn match llvmNoName /[%@!]\d\+\>/
syn match llvmNumber /-\?\<\d\+\>/
syn match llvmFloat /-\?\<\d\+\.\d*\(e[+-]\d\+\)\?\>/
syn match llvmFloat /\<0x\x\+\>/
syn keyword llvmBoolean true false
syn keyword llvmConstant zeroinitializer undef null none
syn match llvmComment /;.*$/
syn region llvmString start=/"/ skip=/\\"/ end=/"/
syn match llvmLabel /[-a-zA-Z$._][-a-zA-Z$._0-9]*:/
syn match llvmIdentifier /[%@][-a-zA-Z$._][-a-zA-Z$._0-9]*/
" Named metadata and specialized metadata keywords.
syn match llvmIdentifier /![-a-zA-Z$._][-a-zA-Z$._0-9]*\ze\s*$/
syn match llvmIdentifier /![-a-zA-Z$._][-a-zA-Z$._0-9]*\ze\s*[=!]/
syn match llvmType /!\zs\a\+\ze\s*(/
syn match llvmConstant /\<DW_TAG_[a-z_]\+\>/
syn match llvmConstant /\<DW_ATE_[a-zA-Z_]\+\>/
syn match llvmConstant /\<DW_OP_[a-zA-Z0-9_]\+\>/
syn match llvmConstant /\<DW_LANG_[a-zA-Z0-9_]\+\>/
syn match llvmConstant /\<DW_VIRTUALITY_[a-z_]\+\>/
syn match llvmConstant /\<DIFlag[A-Za-z]\+\>/
" Syntax-highlight lit test commands and bug numbers.
syn match llvmSpecialComment /;\s*PR\d*\s*$/
syn match llvmSpecialComment /;\s*REQUIRES:.*$/
syn match llvmSpecialComment /;\s*RUN:.*$/
syn match llvmSpecialComment /;\s*CHECK:.*$/
syn match llvmSpecialComment /;\s*XFAIL:.*$/
if version >= 508 || !exists("did_c_syn_inits")
if version < 508
let did_c_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink llvmType Type
HiLink llvmStatement Statement
HiLink llvmNumber Number
HiLink llvmComment Comment
HiLink llvmString String
HiLink llvmLabel Label
HiLink llvmKeyword Keyword
HiLink llvmBoolean Boolean
HiLink llvmFloat Float
HiLink llvmNoName Identifier
HiLink llvmConstant Constant
HiLink llvmSpecialComment SpecialComment
HiLink llvmError Error
HiLink llvmIdentifier Identifier
delcommand HiLink
endif
let b:current_syntax = "llvm"

View File

@ -1,54 +0,0 @@
" Vim syntax file
" Language: TableGen
" Maintainer: The LLVM team, http://llvm.org/
" Version: $Revision$
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" May be changed if you have a really slow machine
syntax sync minlines=100
syn case match
syn keyword tgKeyword def let in code dag field include defm foreach
syn keyword tgType class int string list bit bits multiclass
syn match tgNumber /\<\d\+\>/
syn match tgNumber /\<\d\+\.\d*\>/
syn match tgNumber /\<0b[01]\+\>/
syn match tgNumber /\<0x[0-9a-fA-F]\+\>/
syn region tgString start=/"/ skip=/\\"/ end=/"/ oneline
syn region tgCode start=/\[{/ end=/}\]/
syn keyword tgTodo contained TODO FIXME
syn match tgComment /\/\/.*$/ contains=tgTodo
" Handle correctly imbricated comment
syn region tgComment2 matchgroup=tgComment2 start=+/\*+ end=+\*/+ contains=tgTodo,tgComment2
if version >= 508 || !exists("did_c_syn_inits")
if version < 508
let did_c_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink tgKeyword Statement
HiLink tgType Type
HiLink tgNumber Number
HiLink tgComment Comment
HiLink tgComment2 Comment
HiLink tgString String
" May find a better Hilight group...
HiLink tgCode Special
HiLink tgTodo Todo
delcommand HiLink
endif
let b:current_syntax = "tablegen"

View File

@ -1,228 +0,0 @@
" LLVM coding guidelines conformance for VIM
" $Revision$
"
" Maintainer: The LLVM Team, http://llvm.org
" WARNING: Read before you source in all these commands and macros! Some
" of them may change VIM behavior that you depend on.
"
" You can run VIM with these settings without changing your current setup with:
" $ vim -u /path/to/llvm/utils/vim/vimrc
" It's VIM, not VI
set nocompatible
" A tab produces a 2-space indentation
set softtabstop=2
set shiftwidth=2
set expandtab
" Highlight trailing whitespace and lines longer than 80 columns.
highlight LongLine ctermbg=DarkYellow guibg=DarkYellow
highlight WhitespaceEOL ctermbg=DarkYellow guibg=DarkYellow
if v:version >= 702
" Lines longer than 80 columns.
au BufWinEnter * let w:m0=matchadd('LongLine', '\%>80v.\+', -1)
" Whitespace at the end of a line. This little dance suppresses
" whitespace that has just been typed.
au BufWinEnter * let w:m1=matchadd('WhitespaceEOL', '\s\+$', -1)
au InsertEnter * call matchdelete(w:m1)
au InsertEnter * let w:m2=matchadd('WhitespaceEOL', '\s\+\%#\@<!$', -1)
au InsertLeave * call matchdelete(w:m2)
au InsertLeave * let w:m1=matchadd('WhitespaceEOL', '\s\+$', -1)
else
au BufRead,BufNewFile * syntax match LongLine /\%>80v.\+/
au InsertEnter * syntax match WhitespaceEOL /\s\+\%#\@<!$/
au InsertLeave * syntax match WhitespaceEOL /\s\+$/
endif
" Enable filetype detection
filetype on
" Optional
" C/C++ programming helpers
augroup csrc
au!
autocmd FileType * set nocindent smartindent
autocmd FileType c,cpp set cindent
augroup END
" Set a few indentation parameters. See the VIM help for cinoptions-values for
" details. These aren't absolute rules; they're just an approximation of
" common style in LLVM source.
set cinoptions=:0,g0,(0,Ws,l1
" Add and delete spaces in increments of `shiftwidth' for tabs
set smarttab
" Highlight syntax in programming languages
syntax on
" LLVM Makefiles can have names such as Makefile.rules or TEST.nightly.Makefile,
" so it's important to categorize them as such.
augroup filetype
au! BufRead,BufNewFile *Makefile* set filetype=make
augroup END
" In Makefiles, don't expand tabs to spaces, since we need the actual tabs
autocmd FileType make set noexpandtab
" Useful macros for cleaning up code to conform to LLVM coding guidelines
" Delete trailing whitespace and tabs at the end of each line
command! DeleteTrailingWs :%s/\s\+$//
" Convert all tab characters to two spaces
command! Untab :%s/\t/ /g
" Enable syntax highlighting for LLVM files. To use, copy
" utils/vim/syntax/llvm.vim to ~/.vim/syntax .
augroup filetype
au! BufRead,BufNewFile *.ll set filetype=llvm
augroup END
" Enable syntax highlighting for tablegen files. To use, copy
" utils/vim/syntax/tablegen.vim to ~/.vim/syntax .
augroup filetype
au! BufRead,BufNewFile *.td set filetype=tablegen
augroup END
" Enable syntax highlighting for reStructuredText files. To use, copy
" rest.vim (http://www.vim.org/scripts/script.php?script_id=973)
" to ~/.vim/syntax .
augroup filetype
au! BufRead,BufNewFile *.rst set filetype=rest
augroup END
" Additional vim features to optionally uncomment.
"set showcmd
"set showmatch
"set showmode
"set incsearch
"set ruler
" Clang code-completion support. This is somewhat experimental!
" A path to a clang executable.
let g:clang_path = "clang++"
" A list of options to add to the clang commandline, for example to add
" include paths, predefined macros, and language options.
let g:clang_opts = [
\ "-x","c++",
\ "-D__STDC_LIMIT_MACROS=1","-D__STDC_CONSTANT_MACROS=1",
\ "-Iinclude" ]
function! ClangComplete(findstart, base)
if a:findstart == 1
" In findstart mode, look for the beginning of the current identifier.
let l:line = getline('.')
let l:start = col('.') - 1
while l:start > 0 && l:line[l:start - 1] =~ '\i'
let l:start -= 1
endwhile
return l:start
endif
" Get the current line and column numbers.
let l:l = line('.')
let l:c = col('.')
" Build a clang commandline to do code completion on stdin.
let l:the_command = shellescape(g:clang_path) .
\ " -cc1 -code-completion-at=-:" . l:l . ":" . l:c
for l:opt in g:clang_opts
let l:the_command .= " " . shellescape(l:opt)
endfor
" Copy the contents of the current buffer into a string for stdin.
" TODO: The extra space at the end is for working around clang's
" apparent inability to do code completion at the very end of the
" input.
" TODO: Is it better to feed clang the entire file instead of truncating
" it at the current line?
let l:process_input = join(getline(1, l:l), "\n") . " "
" Run it!
let l:input_lines = split(system(l:the_command, l:process_input), "\n")
" Parse the output.
for l:input_line in l:input_lines
" Vim's substring operator is annoyingly inconsistent with python's.
if l:input_line[:11] == 'COMPLETION: '
let l:value = l:input_line[12:]
" Chop off anything after " : ", if present, and move it to the menu.
let l:menu = ""
let l:spacecolonspace = stridx(l:value, " : ")
if l:spacecolonspace != -1
let l:menu = l:value[l:spacecolonspace+3:]
let l:value = l:value[:l:spacecolonspace-1]
endif
" Chop off " (Hidden)", if present, and move it to the menu.
let l:hidden = stridx(l:value, " (Hidden)")
if l:hidden != -1
let l:menu .= " (Hidden)"
let l:value = l:value[:l:hidden-1]
endif
" Handle "Pattern". TODO: Make clang less weird.
if l:value == "Pattern"
let l:value = l:menu
let l:pound = stridx(l:value, "#")
" Truncate the at the first [#, <#, or {#.
if l:pound != -1
let l:value = l:value[:l:pound-2]
endif
endif
" Filter out results which don't match the base string.
if a:base != ""
if l:value[:strlen(a:base)-1] != a:base
continue
end
endif
" TODO: Don't dump the raw input into info, though it's nice for now.
" TODO: The kind string?
let l:item = {
\ "word": l:value,
\ "menu": l:menu,
\ "info": l:input_line,
\ "dup": 1 }
" Report a result.
if complete_add(l:item) == 0
return []
endif
if complete_check()
return []
endif
elseif l:input_line[:9] == "OVERLOAD: "
" An overload candidate. Use a crazy hack to get vim to
" display the results. TODO: Make this better.
let l:value = l:input_line[10:]
let l:item = {
\ "word": " ",
\ "menu": l:value,
\ "info": l:input_line,
\ "dup": 1}
" Report a result.
if complete_add(l:item) == 0
return []
endif
if complete_check()
return []
endif
endif
endfor
return []
endfunction ClangComplete
" This to enables the somewhat-experimental clang-based
" autocompletion support.
set omnifunc=ClangComplete