[tools] Add a tool for finding builtins
Example usage: tools/find-builtin LoadIC | xargs code -g Change-Id: I12c15d3d4a80edbcddfa9cc8b9a515b839c96fdf Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2808949 Commit-Queue: Leszek Swirski <leszeks@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Auto-Submit: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/master@{#73827}
This commit is contained in:
parent
301f3a4d19
commit
9d33c4e68e
24
tools/find-builtin
Executable file
24
tools/find-builtin
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
BUILTIN_NAME="$1"
|
||||
|
||||
if ! which rg >/dev/null ; then
|
||||
echo >&2 "This tool requires 'rg', install it with 'sudo apt install ripgrep'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TOOLS_DIRNAME="$(dirname "$0")"
|
||||
V8_DIRNAME="$(dirname "$TOOLS_DIRNAME")"
|
||||
|
||||
if rg --type-add 'tq:*.tq' --type tq --with-filename --line-number "\bbuiltin $BUILTIN_NAME\b" "$V8_DIRNAME" | rg -v '\bextern builtin\b' | cut -f1-2 -d: ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if rg --type cpp --with-filename --line-number "\b(TF_BUILTIN\(|::Generate_?)$BUILTIN_NAME\b" "$V8_DIRNAME" | cut -f1-2 -d: ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo >&2 "Builtin '$BUILTIN_NAME' not found"
|
||||
exit 1
|
Loading…
Reference in New Issue
Block a user