This is an archive of the discontinued LLVM Phabricator instance.

[mlir:LSP] Add a quickfix code action for inserting expected-* diagnostic checks
ClosedPublic

Authored by rriddle on Jul 20 2022, 1:46 AM.

Details

Summary

This allows for automatically inserting expected checks for parser and verifier
diagnostics, which simplifies the workflow when building new dialect
constructs or extending existing ones.

Diff Detail

Event Timeline

rriddle created this revision.Jul 20 2022, 1:46 AM
rriddle requested review of this revision.Jul 20 2022, 1:46 AM
rriddle updated this revision to Diff 446083.Jul 20 2022, 1:57 AM
rriddle updated this revision to Diff 446251.Jul 20 2022, 1:19 PM
jpienaar accepted this revision.Jul 20 2022, 2:13 PM

Nice!

mlir/lib/Tools/lsp-server-support/Protocol.h
1117

Map too heavy to create/not useful?

mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
841

And the above flushes on destruction?

This revision is now accepted and ready to land.Jul 20 2022, 2:13 PM
rriddle marked 2 inline comments as done.Jul 20 2022, 2:39 PM
rriddle added inline comments.
mlir/lib/Tools/lsp-server-support/Protocol.h
1117

These classes generally map directly to how the LSP spec specifies the data, so I write them how they are described there. Outside of that though, this vector is generally so small (generally 1-3 elements), that using vector is going to be more optimal than map anyways.

mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp
841

raw_string_ostream is unbuffered and should always write directly to the string, e.g. .str() just returns the string directly.

https://github.com/llvm/llvm-project/blob/0c1b32717bcffcf8edf95294e98933bd4c1e76ed/llvm/include/llvm/Support/raw_ostream.h#L630