Instantiate ParentMap

Hi,

How to Instantiate the ParentMap,somebody would give me an example,Thank
you!

Best regards,
Rambo

Hi, Rambo. The ParentMap in AST is a very simple object: you just give it a top-level statement (usually your entire function body) and it recursively builds the map for you. If you're working in the static analyzer or with the analysis-based compiler warnings, the AnalysisDeclContext has a ParentMap already built (to save you the trouble of recreating it, and also to automatically handle constructor initializers).

ASTMatchers has its own ParentMapASTVisitor, which builds a map of not just statements but also other types of AST nodes. I'm not so familiar with how this one works.

Jordan