2

Is there any C++ source code browser or analyzer which gives 'source code query' feature? For example, I want to find lines in source files like these.

  • Find C++ function declarations which has more than 5 parameters
  • Find C++ virtual functions whose implementation is written in header files

There seems to be a way like Exploring the Visual C++ Browse Database , but mainly its documentation is not to be found.

I checked out Clang for developing it for myself, but it involves too much to learn before developing it.

2
  • That sounds like a potential extension for Eclipse' functionality actually (it doesn't have that now). Anyway, I rather doubt this is available, although I can see the use in it.
    – einpoklum
    Jul 15, 2017 at 11:21
  • sonarqube has a c++ analyzer api. It is far from being queriable, but essentially it is walking over your code and you can implement classes with callbacks to the various entity types.
    – peterh
    Jul 18, 2017 at 12:44

1 Answer 1

0

I think CppDepend could be the right tool for you.

While I have not worked with CppDepend personally, I have used two similar products of the same company, namely NDepend and JArchitect.

I am very certain it can solve your first problem, since NDepend and JArchitect both have a built-in warning for that.

I am also very confident that it can solve your second request, since it comes with a powerful query language which has never let me down.

Also, support is great. Send an email and Roxanne will respond quickly.

That said, it's not exactly cheap. The license is 899 USD and ~720 USD renewal. Given that C++ is quite a horrible language (personal opinion), the price is okay, IMHO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.