aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/test/clang-query/trailing-comma.c
blob: 4fc0cb0f24187116cf9af557c68b0372d50319c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void foo(void) {}
// CHECK-OK: trailing-comma.c:1:1: note: "root" binds here
// CHECK-ERR-COMMA: Invalid token <,> found when looking for a value.

// RUN: clang-query -c "match \
// RUN:   functionDecl( \
// RUN:     hasName( \
// RUN:       \"foo\", \
// RUN:     ), \
// RUN:   ) \
// RUN: " %s | FileCheck --check-prefix=CHECK-OK %s

// Same with \n tokens
// RUN: echo "match functionDecl( hasName( \"foo\" , ) , )" | sed "s/ /\n/g" >%t
// RUN: clang-query -f %t %s | FileCheck --check-prefix=CHECK-OK %s

// RUN: not clang-query -c "match functionDecl(hasName(\"foo\"),,)" %s \
// RUN:   | FileCheck --check-prefix=CHECK-ERR-COMMA %s

// RUN: not clang-query -c "match functionDecl(,)" %s \
// RUN:   | FileCheck --check-prefix=CHECK-ERR-COMMA %s