c++ - Using libclang/libtooling -
I will retrieve all the structures and types defined in a project (as described in my previous question "") .
I chose the clag solution because this is my only way ... However, I found that only "good" tutorial is this: and still there are some questions left:
1) Is the pre-processor's instructions executed (#include, #define etc.)
2) How to get the type, and structure member?
In fact, for example * simple * code:
typedef struct {int i; Four ii; } S1; Typeface Straight S2 {int i; Structure S2S 2; } S2; Type 3 S3 Straight S3; Straight S3 {int i; Four ii; } S1 m_s1; S2m_s2; Straight S3 m_s3; What is the method called a clang :: recursiveASTVisitor -derived class () and in what order? (And can you explain to me about recovering your data?)
OK , Peterson advised as a mat, I used to experiment.
1) Yes, AST is generated after the preprocessor. This allows all the information to be retrieved.
2) AST Traveler Depth-It's First. Instead of implementing the VisitFoo (Foo *) methods, you can re-implement the TraverseFoo (Foo *) method to get the beginning and end of each node lookup. : Category Your Visitor: Public Recursive Last Visitor & lt; YourVisitor & gt; {// ... Virtual Bull Traversfu (Foo * F) {// To explore kids, first do some stuff b = rursiveASTVisitor & lt; YourVisitor & gt; :: TraverseFoo (f); // something to do after the return}} Then to get the strokes (= records) and their members, just get struct and VisitFieldDecl to re-implement the Structure recorder To Field
Comments
Post a Comment