Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What about using Clangd to reject mutations that would not compile #27

Open
jan-revay opened this issue Aug 24, 2022 · 3 comments
Open

Comments

@jan-revay
Copy link

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.

@nlohmann
Copy link
Owner

What is your exact proposal?

@jan-revay
Copy link
Author

jan-revay commented Aug 25, 2022

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...

@jan-revay
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants