We have a large legacy code base with lots of code which is commented out and is now polluting our source code files. On the other hand we have real comments which I like to preserve.
Is there a way to find comments in C/C++ which are source code and remove them in order to clean up the code base?
Imagine the following code
// the function foo is doing foo
void foo(){
// bar();
bar2();
}
The old function bar() has been commented out and is no longer used. I like to have an automated way to remove the outdated source code but plain text comments should not be touched. Thus after the clean up the code would look like
// the function foo is doing foo
void foo(){
bar2();
}
I found this and that to remove all comments. This is not what I like to do.
Can clang tidy do this job?