Chris Warner 5e9401c2c2
[clang-query] Load queries and matchers from file during REPL cycle (#90603)
The clang-query tool has the ability to execute or pre-load queries from
a file when the tool is launched, but doesn't have the ability to do the
same from the interactive REPL prompt. Because the prompt also doesn't
seem to allow multi-line matchers, this can make prototyping and
iterating on more complicated matchers difficult.

Supporting a dynamic load at REPL time allows the cost of reading the
compilation database and building the AST to be imposed just once, and
allows faster prototyping.
2024-05-13 08:11:39 -04:00

15 lines
503 B
C

// RUN: rm -rf %/t
// RUN: mkdir %/t
// RUN: cp %/S/Inputs/file.script %/t/file.script
// RUN: cp %/S/Inputs/runtime_file.script %/t/runtime_file.script
// Need to embed the correct temp path in the actual JSON-RPC requests.
// RUN: sed -e "s|DIRECTORY|%/t|" %/t/file.script > %/t/file.script.temp
// RUN: clang-query -c 'file %/t/file.script.temp' %s -- | FileCheck %s
// CHECK: file-query.c:11:1: note: "f" binds here
void bar(void) {}
// CHECK: file-query.c:14:1: note: "v" binds here
int baz{1};