Esempio n. 1
0
    Nodecl::Symbol Symbol::make_nodecl(bool set_ref_type, const locus_t* locus) const
    {
        Nodecl::Symbol sym = Nodecl::Symbol::make(*this, locus);
        if (set_ref_type)
        {
            TL::Type t = this->get_type();
            if (!t.is_any_reference())
                t = t.get_lvalue_reference_to();

            sym.set_type(t);
        }
        else
        {
            sym.set_type(this->get_type());
        }

        // Set constant (currently only for variables)
        if (this->is_variable()
                && this->get_type().is_const()
                && !this->is_parameter() // avoid 'void f(const int n = 3)'
                && !this->get_value().is_null()
                && this->get_value().is_constant())
        {
            sym.set_constant(this->get_value().get_constant());
        }

        return sym;
    }
Esempio n. 2
0
    Nodecl::Symbol Symbol::make_nodecl(bool set_ref_type, const locus_t* locus) const
    {
        Nodecl::Symbol sym = Nodecl::Symbol::make(*this, locus);
        if (set_ref_type)
        {
            TL::Type t = this->get_type();
            if (!t.is_any_reference())
                t = t.get_lvalue_reference_to();

            sym.set_type(t);
        }
        return sym;
    }