Exemplo n.º 1
0
void DepGenerator::writeAST(const AST& ast, StringBuilder& output, unsigned indent, bool isExternal) const {
    for (unsigned i=0; i<ast.numTypes(); i++) {
        const Decl* D = ast.getType(i);
        if (isExternal && !D->isUsed()) continue;
        writeDecl(D, output, indent);
    }
    for (unsigned i=0; i<ast.numVars(); i++) {
        const Decl* D = ast.getVar(i);
        if (isExternal && !D->isUsed()) continue;
        writeDecl(D, output, indent);
    }
    for (unsigned i=0; i<ast.numFunctions(); i++) {
        const Decl* D = ast.getFunction(i);
        if (isExternal && !D->isUsed()) continue;
        writeDecl(D, output, indent);
    }
}
Exemplo n.º 2
0
void TagWriter::analyse(const AST& ast) {
    currentFile = getFile(ast.getFileName());

    for (unsigned i=0; i<ast.numTypes(); i++) {
        TagVisitor visitor(*this, ast.getType(i), SM);
        visitor.run();
    }
    for (unsigned i=0; i<ast.numVars(); i++) {
        TagVisitor visitor(*this, ast.getVar(i), SM);
        visitor.run();
    }
    for (unsigned i=0; i<ast.numFunctions(); i++) {
        TagVisitor visitor(*this, ast.getFunction(i), SM);
        visitor.run();
    }
    // TODO TypeDecls ArrayValueDecls
}
Exemplo n.º 3
0
void DepGenerator::writeAST(const AST& ast, StringBuilder& output, unsigned indent) const {
    if (showExternals) {
        for (unsigned i=0; i<ast.numImports(); i++) {
            const ImportDecl* U = ast.getImport(i);
            QualType Q = U->getType();
            const ModuleType* T = cast<ModuleType>(Q.getTypePtr());
            const Module* P = T->getModule();
            assert(P);
            if (P->isExternal()) addExternal(P);
        }
    }
    for (unsigned i=0; i<ast.numTypes(); i++) {
        writeDecl(ast.getType(i), output, indent);
    }
    for (unsigned i=0; i<ast.numVars(); i++) {
       writeDecl(ast.getVar(i), output, indent);
    }
    for (unsigned i=0; i<ast.numFunctions(); i++) {
        writeDecl(ast.getFunction(i), output, indent);
    }
}