cppcheck icon indicating copy to clipboard operation
cppcheck copied to clipboard

ValueFlow: extracted more code into separate files

Open firewave opened this issue 1 year ago • 5 comments

firewave avatar May 26 '24 20:05 firewave

@danmar can this be merged? It is not different in principal from the previous change I did in this and it blocks a lot of follow-ups (including prototyping some of the bigger refactoring still needed).

firewave avatar Jun 11 '24 19:06 firewave

Isn't this going too extreme? Putting every function in a separate file. There are many small files that are less than 100 lines of code.

danmar avatar Jun 17 '24 09:06 danmar

Isn't this going too extreme? Putting every function in a separate file. There are many small files that are less than 100 lines of code.

This is just because these are the low-hanging cases. And it is quite possible we might enhance the steps in the future so there might be more code.

This also allows us to actually write a unit test for each of these. It also makes it way easier to review the code (and I have a bunch of smaller cleanups coming).

firewave avatar Jun 17 '24 09:06 firewave

I would still say it's pretty extreme to put each function in a separate file. We could end up with 1000's of files if you continue to refactor cppcheck.

As far as I see we can still write the same unit tests if we have several functions in a file.

danmar avatar Jun 26 '24 09:06 danmar

I would still say it's pretty extreme to put each function in a separate file. We could end up with 1000's of files if you continue to refactor cppcheck.

We are not extracting an infinite number of functions but a finite number of passes with differing complexity.

Some other functionality will also be factored out but those involve a lot of code.

firewave avatar Jul 01 '24 08:07 firewave

splitting out each function into a separate file that is extreme to me. how about a file for all "non-analyzer" passes.

this was always the plan from the beginning so the previous PR should have never been approved and there was some back and froth while this could have been brought up.

I would not want that we continue and split up astutils tokenizer etc like this.

I am not going to do that. valueflow.cpp is extremely monolithic, is slow to compile and is just way too big. That partially applies to some of the other files as well but there is not much which could be factored out. the ValueFlow is different in that way.

firewave avatar Jul 11 '24 07:07 firewave