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

Mull skips macros #870

Closed
AndreiBogdanPislaru opened this issue Jun 3, 2021 · 5 comments
Closed

Mull skips macros #870

AndreiBogdanPislaru opened this issue Jun 3, 2021 · 5 comments

Comments

@AndreiBogdanPislaru
Copy link

AndreiBogdanPislaru commented Jun 3, 2021

Hello, it's me again :D, I noticed that mull doesn't analyze a couple of file whose code is under #define, is this normal or do I keep missing some flags?

@AndreiBogdanPislaru AndreiBogdanPislaru changed the title Mull skips macros Mull skips macros and one more thing Jun 3, 2021
@AndreiBogdanPislaru AndreiBogdanPislaru changed the title Mull skips macros and one more thing Mull skips macros Jun 3, 2021
@AlexDenisov
Copy link
Member

Mull skips any potential mutations that are part of the macro invocations.
One of the reasons is that the debug information is kinda broken with macros, for the following code:

#define something(x) x
/// ...
something(a   b)

mull generates cxx_add_to_sub mutant for the a b, but the debug information for this expression points to the beginning of the macro:

something(a   b)
^

during the junk detection we cannot say for sure if the mutation is valid or not, so we discard it to be on the safe side.

I remember we touched this topic briefly while discussing AST mutations, but I don't recall the conclusion.
Maybe @stanislaw can add something? :)

@RobertoBagnara
Copy link

Would it be possible/sensible to apply Mull to the preprocessed sources?

@stanislaw
Copy link
Member

Would it be possible/sensible to apply Mull to the preprocessed sources?

There are two answers to this question:

  1. It is one of the limitations of the IR-level mutations that we couldn't find a workaround for: imprecision of the debug information for the preprocessed parts.

(see Alex's answer above)

This was a state of the previous versions of LLVM and there is a small chance that this could improve. This is something that we could check.

  1. On the AST level, it should be possible to implement this, but we simply haven't done it yet. It is a good idea to include the mutations in the preprocessed sources to the AST roadmap here: Roadmap: AST-level mutations #867 (done just now).

@RobertoBagnara
Copy link

RobertoBagnara commented Jun 4, 2021 via email

@AlexDenisov
Copy link
Member

Hi @RobertoBagnara, it's certainly possible to run mull against preprocessed source code. As long as you can build an executable that has bitcode embedded in it you are good to go.

Though, you may get many more mutants that you want. As part of the normal run mull discards all the mutants that are coming from the "system" headers. I'm afraid in the case of a preprocessed file mull won't be able to distinguish between a "system" function and the "user" functions.

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

4 participants