コード例 #1
0
ファイル: sageDoxygen.C プロジェクト: rose-compiler/rose-edg3
string
Doxygen::getQualifiedPrototype(SgNode *node)
{
    SgClassDeclaration *cd = dynamic_cast<SgClassDeclaration *>(node);
    if (cd) return getProtoName(cd);
    SgUnparse_Info info;
    info.set_SkipSemiColon();
    info.set_SkipFunctionDefinition();
    info.set_forceQualifiedNames();
    info.set_skipCheckAccess();
    info.set_SkipClassSpecifier();
    info.set_SkipInitializer();
    info.set_current_scope(TransformationSupport::getGlobalScope(node));

    string proto = node->unparseToString(&info);
    while (proto[proto.size()-1] == '\n') { /* sometimes the prototype will be unparsed with a newline at the end */
        proto.resize(proto.size()-1);
    }
    return proto;
}
コード例 #2
0
ファイル: sageDoxygen.C プロジェクト: rose-compiler/rose-edg3
string
Doxygen::getProtoName(SgDeclarationStatement *st)
{
    SgScopeStatement *scope;
    if (SgVariableDeclaration* varDeclSt = isSgVariableDeclaration(st))
    {
        // TODO: uncomment SgVariableDeclaration::get_scope removing need for this code
        scope = varDeclSt->get_variables().front()->get_scope();
    }
    else
    {
        scope = st->get_scope();
    }
    if (isSgGlobal(scope))
    {
        return getDeclStmtName(st);
    }
    else
    {
        SgUnparse_Info info;
        info.set_SkipSemiColon();
        info.set_SkipFunctionDefinition();
        info.set_forceQualifiedNames();
        info.set_skipCheckAccess();
        info.set_SkipInitializer();
        info.set_SkipClassSpecifier();
        //AS(091507) In the new version of ROSE global qualifiers are paret of the qualified name of
        //a scope statement. For the documentation work we do not want that and we therefore use string::substr()
        //to trim of  "::" from the front of the qualified name.

        if( scope->get_qualified_name().getString().length() > 2 )
        {
            return scope->get_qualified_name().getString().substr(2)+("::"+getDeclStmtName(st));
        } else {
            return getDeclStmtName(st);

        }

        //return scope->get_qualified_name().str()+("::"+getDeclStmtName(st));
    }
}