From f78505e37b91651d57f439f34cbcb441c98b59a1 Mon Sep 17 00:00:00 2001 From: "John F. Carr" Date: Tue, 8 Oct 2024 14:41:10 -0400 Subject: [PATCH] Test go to definition of control variable and limit variable of cilk_for loop --- clang-tools-extra/clangd/test/cilk_for.test | 76 +++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 clang-tools-extra/clangd/test/cilk_for.test diff --git a/clang-tools-extra/clangd/test/cilk_for.test b/clang-tools-extra/clangd/test/cilk_for.test new file mode 100644 index 000000000000..b9bda73b72aa --- /dev/null +++ b/clang-tools-extra/clangd/test/cilk_for.test @@ -0,0 +1,76 @@ +# RUN: clangd -lit-test < %s | FileCheck %s +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off","initializationOptions":{"fallbackFlags":["-fopencilk"]}}} +--- +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///for.c","languageId":"c","version":1,"text":"void f(int nn) {\n _Cilk_for(int ii = 99; ii < nn; ii += 1) { int jj = ii;}\n}"}}} +--- +{"jsonrpc":"2.0","id":1,"method":"textDocument/definition","params":{"textDocument":{"uri":"test:///for.c"},"position":{"line":1,"character":25}}} +--- +{"jsonrpc":"2.0","id":2,"method":"textDocument/definition","params":{"textDocument":{"uri":"test:///for.c"},"position":{"line":1,"character":31}}} +--- +{"jsonrpc":"2.0","id":3,"method":"textDocument/definition","params":{"textDocument":{"uri":"test:///for.c"},"position":{"line":1,"character":35}}} +--- +{"jsonrpc":"2.0","id":4,"method":"textDocument/definition","params":{"textDocument":{"uri":"test:///for.c"},"position":{"line":1,"character":54}}} +--- +{"jsonrpc":"2.0","id":2,"method":"shutdown"} +--- +{"jsonrpc":"2.0","method":"exit"} +# Find use of control variable inside loop condition. +# CHECK: "id": 1, +# CHECK-NEXT: "jsonrpc": "2.0", +# CHECK-NEXT: "result": [ +# CHECK-NEXT: { +# CHECK-NEXT: "range": { +# CHECK-NEXT: "end": { +# CHECK-NEXT: "character": 18, +# CHECK-NEXT: "line": 1 +# CHECK-NEXT: }, +# CHECK-NEXT: "start": { +# CHECK-NEXT: "character": 16, +# CHECK-NEXT: "line": 1 +# CHECK-NEXT: } +# CHECK-NEXT: }, +# Find use of limit variable inside loop condition. +# CHECK: "id": 2, +# CHECK-NEXT: "jsonrpc": "2.0", +# CHECK-NEXT: "result": [ +# CHECK-NEXT: { +# CHECK-NEXT: "range": { +# CHECK-NEXT: "end": { +# CHECK-NEXT: "character": 13, +# CHECK-NEXT: "line": 0 +# CHECK-NEXT: }, +# CHECK-NEXT: "start": { +# CHECK-NEXT: "character": 11, +# CHECK-NEXT: "line": 0 +# CHECK-NEXT: } +# CHECK-NEXT: }, +# Find use of control variable inside loop increment. +# CHECK: "id": 3, +# CHECK-NEXT: "jsonrpc": "2.0", +# CHECK-NEXT: "result": [ +# CHECK-NEXT: { +# CHECK-NEXT: "range": { +# CHECK-NEXT: "end": { +# CHECK-NEXT: "character": 18, +# CHECK-NEXT: "line": 1 +# CHECK-NEXT: }, +# CHECK-NEXT: "start": { +# CHECK-NEXT: "character": 16, +# CHECK-NEXT: "line": 1 +# CHECK-NEXT: } +# CHECK-NEXT: }, +# Find use of control variable inside loop body. +# CHECK: "id": 4, +# CHECK-NEXT: "jsonrpc": "2.0", +# CHECK-NEXT: "result": [ +# CHECK-NEXT: { +# CHECK-NEXT: "range": { +# CHECK-NEXT: "end": { +# CHECK-NEXT: "character": 18, +# CHECK-NEXT: "line": 1 +# CHECK-NEXT: }, +# CHECK-NEXT: "start": { +# CHECK-NEXT: "character": 16, +# CHECK-NEXT: "line": 1 +# CHECK-NEXT: } +# CHECK-NEXT: },