11

In short: I am looking for something like Roslyn but for C++.

In detail:

I am dealing with a c# project where I have to work with c++ files. I have a bunch of .h (about 250 files) and .cpp and I would like to map the classes and functions and what not, that are defined in these files.

It is for a modeling task. I do not wish to use the actual c++ library.

I did not write the c++ code, so I cannot be sure if there are nested classes anywhere. So this is not a "simple" regex task.

The project is in c#, and the library I'd like to use is in c++. I cannot change that.

Tenshiko
  • 1,450
  • 3
  • 17
  • 33
  • 2
    Even if there were no nested classes, that still would not be a "simple" thing to do. What about template instantiations? For what it's worth, this is what the Clang guys are trying to do, but AFAIK it's a big pain to get working on some platforms. – Billy ONeal Apr 17 '12 at 22:15
  • 1
    possible duplicate of [How to parse/simple analyze C/C++ code from C# to get a list of methods](http://stackoverflow.com/questions/8817712/how-to-parse-simple-analyze-c-c-code-from-c-sharp-to-get-a-list-of-methods) – Tamás Szelei Apr 17 '12 at 22:36

1 Answers1

12

I believe libclang has the functionality you want. It's basically a C interface for accessing much of the information stored in clang's C/C++ AST. The documentation is a bit terse so here is a good video on what it can do with some examples.

David Brown
  • 13,336
  • 4
  • 38
  • 55
  • You convinced me. :) I started to work with libclang. The video was a very good start for me. Any more tutorials/walkthroughs you recommend? – Tenshiko Apr 30 '12 at 17:43