Example #1
0
        private CXChildVisitResult ContextVisitor(CXCursor cursor, CXCursor parent, IntPtr data)
        {
            // prepare context handle
            GCHandle      contextHandle = (GCHandle)data;
            List <string> context       = contextHandle.Target as List <string>;

            if (ClangTraits.IsNonTypeTemplateParamLiteral(cursor))
            {
                List <string> tokens  = ASTVisitor.GetCursorTokens(cursor);
                string        literal = string.Concat(tokens);
                context.Add(literal);
            }
            else if (ClangTraits.IsTemplateRef(cursor))
            {
                CXCursor refCursor = clang.getCursorReferenced(cursor);
                if (ClangTraits.IsTemplateAlias(refCursor))
                {
                    //clang.visitChildren(refCursor, ContextVisitor, new CXClientData(data));
                    clang.visitChildren(refCursor, (CXCursor c, CXCursor p, IntPtr d) =>
                    {
                        if (CXCursorKind.CXCursor_TypeAliasDecl == c.kind)
                        {
                            return(CXChildVisitResult.CXChildVisit_Recurse);
                        }
                        ContextVisitor(c, p, d);
                        return(CXChildVisitResult.CXChildVisit_Continue);
                    }, new CXClientData(data));
                }
            }

            return(CXChildVisitResult.CXChildVisit_Continue);
        }