cppcheck icon indicating copy to clipboard operation
cppcheck copied to clipboard

ValueFlow: start splitting it into multiple files

Open firewave opened this issue 2 years ago • 12 comments

valueflow.cpp is very monolithic which makes it hard to manage. This is splitting several parts into separate files as discussed in #4642.

firewave avatar Jan 28 '23 11:01 firewave

@pfultz2 Please have a look. This is the initial approach which works quite well. I already did further functions up to the first more complex case valueFlowForwardLifetime() were it gets quite granular but we can discuss this after decided if this approach is fine.

I will also get rid of the using namespace ValueFlow within the split files since it makes things harder to understand when the increased granularity kicks in.

firewave avatar Jan 28 '23 11:01 firewave

I am reworking this a bit and will fix the matchcompiler and CMake.

firewave avatar Jan 29 '23 13:01 firewave

Still needs matchcompiler support.

Also need to make sure it doesn't impact the performance negatively now the code is no longer completely visible to some of the callers.

firewave avatar Jan 31 '23 13:01 firewave

I will also get rid of the using namespace ValueFlow within the split files since it makes things harder to understand when the increased granularity kicks in.

Wrapping in namespace ValueFlow { ... } will get rid of that.

pfultz2 avatar Feb 04 '23 21:02 pfultz2

I will also get rid of the using namespace ValueFlow within the split files since it makes things harder to understand when the increased granularity kicks in.

Wrapping in namespace ValueFlow { ... } will get rid of that.

I don't like that the indentation is being increased by that. I think it's nicer to simply add a single line and having them all aligned to the first line.

firewave avatar Feb 04 '23 22:02 firewave

This currently doesn't play well with the matchcompiler. I have it working in CMake but the regular make is still an issue. It also seems there's some code in it which we don't need anymore.

firewave avatar Feb 04 '23 22:02 firewave

I don't like that the indentation is being increased by that. I think it's nicer to simply add a single line and having them all aligned to the first line.

We should update the formatting to not indent for namespace scopes.

pfultz2 avatar Feb 10 '23 17:02 pfultz2

I will give this another stab after #6298 has been merged.

firewave avatar Apr 20 '24 17:04 firewave

Since it complicates things and does not match the structure the project has been using all along I will omit introducing a subfolder and introduce an underscore in the filenames instead (although that also doesn't match what has been done so far).

firewave avatar Apr 20 '24 17:04 firewave

Re-did the first commit, will re-add the others later.

Having this in individual files might also allow us to write unit (and maybe performance tests) for the respective analyze steps.

firewave avatar Apr 21 '24 13:04 firewave

We could already merge this as a start or I could move yet another step. IMO this change is way too big to do it in a single commit.

After all the steps have been moved out I will do the further suggested split of the common code.

firewave avatar Apr 22 '24 10:04 firewave

Any feedback on this? I would like to proceed on this so it is done within this dev cycle. Also so we could maybe do some work on #6097.

firewave avatar May 06 '24 12:05 firewave