Open jan-revay opened 2 years ago
What is your exact proposal?
The proposal is to start clangd as a part of the "Generate patches" run and use LSP to syntactically validate the patches before adding them to the database. I think that Clangd should be able to syntactically validate the patches much quicker than compiler would, as I think that Clangd does not need to reparse the whole document if only one line changed.
This would save hours of time as there is no point in trying to compile patches that are obviously syntactically invalid, e.g. a patch
std::string a = "lksjflskdjf"; -> std::string a |= "lksjflskdjf";
should not even get to the compilation stage, IMO...
Resp. to be super exact: Mutate_cpp would listen to Clangd LSP messages such as
{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[{"code":"exponent_has_no_digits","message":"Exponent has no digits","range":{"end":{"character":50,"line":210},"start":{"character":49,"line":210}},"relatedInformation":[],"severity":1,"source":"clang"}
either during execution of the queue or during generation of the patchsets. It should be relatively easy to implement I guess.
The point is that Clangd can probably detect errors much quicker than compiler itself as it uses indexing, and it does not need to reparse the whole file after just a single line was changes. Only the mutations that passed Clangd syntactic check would be compiled.