mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-03 11:23:58 +00:00
01652d889c
This commit adds a new PDLL specific LSP command, pdll.viewOutput, that allows for viewing the intermediate outputs of a given PDLL file. The available intermediate forms currently mirror those in mlir-pdll, namely: AST, MLIR, CPP. This is extremely useful for a developer of PDLL, as it simplifies various testing, and is also quite useful for users as they can easily view what is actually being generated for their PDLL files. This new command is added to the vscode client, and is available in the right client context menu of PDLL files, or via the vscode command palette. Differential Revision: https://reviews.llvm.org/D124783
44 lines
1.4 KiB
Plaintext
44 lines
1.4 KiB
Plaintext
// RUN: mlir-pdll-lsp-server -lit-test < %s | FileCheck -strict-whitespace %s
|
|
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"pdll","capabilities":{},"trace":"off"}}
|
|
// -----
|
|
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{
|
|
"uri":"test:///foo.pdll",
|
|
"languageId":"pdll",
|
|
"version":1,
|
|
"text":"Pattern TestPat => erase op<test.op>;"
|
|
}}}
|
|
// -----
|
|
{"jsonrpc":"2.0","id":1,"method":"pdll/viewOutput","params":{
|
|
"uri":"test:///foo.pdll",
|
|
"kind":"ast"
|
|
}}
|
|
// CHECK: "id": 1
|
|
// CHECK-NEXT: "jsonrpc": "2.0",
|
|
// CHECK-NEXT: "result": {
|
|
// CHECK-NEXT: "output": "-Module{{.*}}PatternDecl{{.*}}Name<TestPat>{{.*}}\n"
|
|
// CHECK-NEXT: }
|
|
// -----
|
|
{"jsonrpc":"2.0","id":2,"method":"pdll/viewOutput","params":{
|
|
"uri":"test:///foo.pdll",
|
|
"kind":"mlir"
|
|
}}
|
|
// CHECK: "id": 2
|
|
// CHECK-NEXT: "jsonrpc": "2.0",
|
|
// CHECK-NEXT: "result": {
|
|
// CHECK-NEXT: "output": "module {\n pdl.pattern @TestPat {{.*}}\n"
|
|
// CHECK-NEXT: }
|
|
// -----
|
|
{"jsonrpc":"2.0","id":3,"method":"pdll/viewOutput","params":{
|
|
"uri":"test:///foo.pdll",
|
|
"kind":"cpp"
|
|
}}
|
|
// CHECK: "id": 3
|
|
// CHECK-NEXT: "jsonrpc": "2.0",
|
|
// CHECK-NEXT: "result": {
|
|
// CHECK-NEXT: "output": "{{.*}}struct TestPat : ::mlir::PDLPatternModule{{.*}}\n"
|
|
// CHECK-NEXT: }
|
|
// -----
|
|
{"jsonrpc":"2.0","id":3,"method":"shutdown"}
|
|
// -----
|
|
{"jsonrpc":"2.0","method":"exit"}
|