void
Win64Object::DirProcFrame(DirectiveInfo& info, Diagnostic& diags)
{
    assert(info.isObject(m_object));
    NameValues& namevals = info.getNameValues();
    SourceLocation source = info.getSource();

    NameValue& name_nv = namevals.front();
    if (!name_nv.isId())
    {
        diags.Report(info.getSource(), diag::err_value_id)
            << name_nv.getValueRange();
        return;
    }
    llvm::StringRef name = name_nv.getId();

    if (m_proc_frame.isValid())
    {
        diags.Report(info.getSource(),
                     diags.getCustomDiagID(Diagnostic::Error,
            "nested procedures not supported (didn't use [ENDPROC_FRAME]?)"));
        diags.Report(m_proc_frame,
                     diags.getCustomDiagID(Diagnostic::Note,
                                           "previous procedure started here"));
        return;
    }
    m_proc_frame = source;
    m_done_prolog = SourceLocation();
    m_unwind.reset(new UnwindInfo);

    SymbolRef proc = m_object.getSymbol(name);
    proc->Use(source);
    m_unwind->setProc(proc);

    // Optional error handler
    if (namevals.size() > 1)
    {
        NameValue& ehandler_nv = namevals[1];
        if (!ehandler_nv.isId())
        {
            diags.Report(info.getSource(), diag::err_value_id)
                << ehandler_nv.getValueRange();
            return;
        }
        SymbolRef ehandler = m_object.getSymbol(ehandler_nv.getId());
        ehandler->Use(ehandler_nv.getValueRange().getBegin());
        m_unwind->setEHandler(ehandler);
    }
}
Example #2
0
std::auto_ptr<Expr>
NameValue::ReleaseExpr(Object& object)
{
    switch (m_type)
    {
        case ID:
        {
            SymbolRef sym = object.getSymbol(getId());
            sym->Use(m_value_range.getBegin());
            return std::auto_ptr<Expr>(new Expr(sym, m_value_range.getBegin()));
        }
        case EXPR:
            return m_expr;
        default:
            return std::auto_ptr<Expr>(0);
    }
}
Example #3
0
Expr
NameValue::getExpr(Object& object) const
{
    switch (m_type)
    {
        case ID:
        {
            SymbolRef sym = object.getSymbol(getId());
            sym->Use(m_value_range.getBegin());
            return Expr(sym);
        }
        case EXPR:
            return *m_expr;
        default:
            assert(false && "name/value not convertible to expression");
            return Expr();
    }
}