From 8b1265b353b027d90252f1a23c5c3121ee70f3a1 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 8 Nov 2013 00:08:23 +0000 Subject: Introduce clang-query tool. This tool is for interactive exploration of the Clang AST using AST matchers. It currently allows the user to enter a matcher at an interactive prompt and view the resulting bindings as diagnostics, AST pretty prints or AST dumps. Example session: $ cat foo.c void foo(void) {} $ clang-query foo.c -- clang-query> match functionDecl() Match #1: foo.c:1:1: note: "root" binds here void foo(void) {} ^~~~~~~~~~~~~~~~~ 1 match. Differential Revision: http://llvm-reviews.chandlerc.com/D2098 llvm-svn: 194227 --- clang-tools-extra/test/clang-query/errors.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 clang-tools-extra/test/clang-query/errors.c (limited to 'clang-tools-extra/test/clang-query/errors.c') diff --git a/clang-tools-extra/test/clang-query/errors.c b/clang-tools-extra/test/clang-query/errors.c new file mode 100644 index 00000000000..96bb6bf216c --- /dev/null +++ b/clang-tools-extra/test/clang-query/errors.c @@ -0,0 +1,11 @@ +// RUN: not clang-query -c foo -c bar %s -- | FileCheck %s +// RUN: not clang-query -f %S/Inputs/foo.script %s -- | FileCheck %s +// RUN: not clang-query -f %S/Inputs/nonexistent.script %s -- 2>&1 | FileCheck --check-prefix=CHECK-NONEXISTENT %s +// RUN: not clang-query -c foo -f foo %s -- 2>&1 | FileCheck --check-prefix=CHECK-BOTH %s +// REQUIRES: libedit + +// CHECK: unknown command: foo +// CHECK-NOT: unknown command: bar + +// CHECK-NONEXISTENT: cannot open {{.*}}nonexistent.script +// CHECK-BOTH: cannot specify both -c and -f -- cgit v1.2.3