-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
_clangd-indexer
184 lines (175 loc) · 10.9 KB
/
_clangd-indexer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#compdef clangd-indexer
# -----------------------------------------------------------------------------
# The BSD-3-Clause License
#
# Copyright (c) 2018, Koichi Shiraishi
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * Neither the name of que nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# -----------------------------------------------------------------------------
#
# LLVM (http://llvm.org/):
# LLVM version 11.0.0git
# Optimized build with assertions.
# Default target: x86_64-apple-darwin19.3.0
# Host CPU: skylake
#
# https://github.com/llvm/llvm-project/tree/84e4c09995a779d5057e2ce831ced9307a8164af/clang-tools-extra/clangd/indexer
#
# -----------------------------------------------------------------------------
#
# OVERVIEW:
# Creates an index of symbol information etc in a whole project.
#
# Example usage for a project using CMake compile commands:
#
# $ clangd-indexer --executor=all-TUs compile_commands.json > clangd.dex
#
# Example usage for file sequence index without flags:
#
# $ clangd-indexer File1.cpp File2.cpp ... FileN.cpp > clangd.dex
#
# Note: only symbols from header files will be indexed.
#
# USAGE: clangd-indexer [options] <source0> [... <sourceN>]
#
# OPTIONS:
#
# Color Options:
#
# This option category has no options.
#
# General options:
#
# --as-secure-log-file-name=<value> - As secure log file name (initialized from AS_SECURE_LOG_FILE env variable)
# --asm-macro-max-nesting-depth=<uint> - The maximum nesting depth allowed for assembly macros.
# --debug - Enable debug output
# --debug-buffer-size=<uint> - Buffer the last N characters of debug output until program termination. [default 0 -- immediate print-out]
# --debug-only=<debug string> - Enable a specific type of debug output (comma separated list of types)
# --disable-symbolication - Disable symbolizing crash backtraces.
# --enable-name-compression - Enable name/filename string compression
# --execute-concurrency=<uint> - The number of threads used to process all files in parallel. Set to 0 for hardware concurrency. This flag only applies to all-TUs.
# --executor=<string> - The name of the executor to use.
# --extra-arg=<string> - Additional argument to append to the compiler command line
# --extra-arg-before=<string> - Additional argument to prepend to the compiler command line
# --filter=<string> - Only process files that match this filter. This flag only applies to all-TUs.
# --format=<value> - Format of the index to be written
# =yaml - human-readable YAML format
# =binary - binary RIFF format
# --import-constants-with-refs - Import constant global variables with references
# --info-output-file=<filename> - File to append -stats and -timer output to
# --non-global-value-max-name-size=<uint> - Maximum size for the name of non-global values.
# --opt-bisect-limit=<int> - Maximum optimization to perform
# -p=<string> - Build path
# --pass-remarks=<pattern> - Enable optimization remarks from passes whose name match the given regular expression
# --pass-remarks-analysis=<pattern> - Enable optimization analysis remarks from passes whose name match the given regular expression
# --pass-remarks-missed=<pattern> - Enable missed optimization remarks from passes whose name match the given regular expression
# --propagate-attrs - Propagate attributes in index
# --remarks-section - Emit a section containing remark diagnostics metadata. By default, this is enabled for the following formats: yaml-strtab, bitstream.
# --rng-seed=<seed> - Seed for the random number generator
# --static-func-full-module-prefix - Use full module build paths in the profile counter names for static functions.
# --static-func-strip-dirname-prefix=<uint> - Strip specified level of directory name from source path in the profile counter name for static functions.
# --stats - Enable statistics output from program (available with Asserts)
# --stats-json - Display statistics as json data
# --track-memory - Enable -time-passes memory tracking (this may be slow)
# --use-dbg-addr - Use llvm.dbg.addr for all local variables
# --view-background - Execute graph viewer in the background. Creates tmp file litter.
#
# Generic Options:
#
# -h - Alias for --help
# --help - Display available options (--help-hidden for more)
# --help-hidden - Display all available options
# --help-list - Display list of available options (--help-list-hidden for more)
# --help-list-hidden - Display list of all available options
# --print-all-options - Print all option values after command line parsing
# --print-options - Print non-default options after command line parsing
# --version - Display the version of this program
#
# -----------------------------------------------------------------------------
function _clangd-indexer() {
local context curcontext=$curcontext state line expl ret=1
declare -A opt_args
local -a _llvm_generic_options
_llvm_generic_options=(
{-h,--help}'[Display available options]'
'--help-hidden[Display all available options]'
'--help-list[Display list of available options]'
'--help-list-hidden[Display list of all available options]'
'--print-all-options[Print all option values after command line parsing]'
'--print-options[Print non-default options after command line parsing]'
'--version[Display the version of this program]'
)
_arguments -C \
'--as-secure-log-file-name=[As secure log file name \(initialized from AS_SECURE_LOG_FILE env variable\)]' \
"--asm-macro-max-nesting-depth=[The maximum nesting depth allowed for assembly macros.]:asm macro's max nesting depth" \
'--debug[Enable debug output]' \
'--debug-buffer-size=[Buffer the last N characters of debug output until program termination. \[default 0 -- immediate print-out\]]:uint' \
'--debug-only=[Enable a specific type of debug output \(comma separated list of types\)]:debug types' \
'--disable-symbolication[Disable symbolizing crash backtraces.]' \
'--enable-name-compression[Enable name/filename string compression]' \
'--execute-concurrency=[The number of threads used to process all files in parallel. Set to 0 for hardware concurrency. This flag only applies to all-TUs.]:num of concurrency execute' \
'--executor=[The name of the executor to use.]:executor:(all-TUs)' \
'--extra-arg=[Additional argument to append to the compiler command line]:extra-arg' \
'--extra-arg-before=[Additional argument to prepend to the compiler command line]:before extra args' \
'--filter=[Only process files that match this filter. This flag only applies to all-TUs.]:filter:(all-TUs)' \
'--format=[Format of the index to be written]: :->format' \
'--import-constants-with-refs[Import constant global variables with references]' \
'--info-output-file=[File to append -stats and -timer output to]:filename:_files' \
'--non-global-value-max-name-size=[Maximum size for the name of non-global values.]:non global value max size' \
'--opt-bisect-limit=[Maximum optimization to perform]:bisect limit' \
'--p=[Build path]:build path:_files' \
'--pass-remarks=[Enable optimization remarks from passes whose name match the given regular expression]:pattern' \
'--pass-remarks-analysis=[Enable optimization analysis remarks from passes whose name match the given regular expression]:pattern' \
'--pass-remarks-missed=[Enable missed optimization remarks from passes whose name match the given regular expression]:pattern' \
'--propagate-attrs[Propagate attributes in index]' \
'--remarks-section[Emit a section containing remark diagnostics metadata. By default, this is enabled for the following formats: yaml-strtab, bitstream.]' \
'--rng-seed=[Seed for the random number generator]:seed' \
'--static-func-full-module-prefix[Use full module build paths in the profile counter names for static functions.]' \
'--static-func-strip-dirname-prefix=[Strip specified level of directory name from source path in the profile counter name for static functions.]:uint' \
'--stats[Enable statistics output from program \(available with Asserts\)]' \
'--stats-json[Display statistics as json data]' \
'--time-trace-granularity=[Minimum time granularity (in microseconds) traced by time profiler]:Minimum time granularity' \
'--track-memory[Enable -time-passes memory tracking \(this may be slow\)]' \
'--use-dbg-addr[Use llvm.dbg.addr for all local variables]' \
'--view-background[Execute graph viewer in the background. Creates tmp file litter.]' \
$_llvm_generic_options \
'*:source:_files' \
&& ret=0
case $state in
format)
local -a format_args
format_args=(
'yaml[human-readable YAML format]'
'binary[binary RIFF format]'
)
_values 'index file format' $format_args
;;
esac
return ret
}
_clangd-indexer "$*"
# vim:ft=zsh:et:sts=2:sw=2