Ignore:
Timestamp:
Dec 4, 2015, 2:55:22 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
000b914, 63db3d76
Parents:
f8b961b
Message:

Added support for alignof expressions for everything but polymorphic types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    rf8b961b r47534159  
    122122void SizeofExpr::print( std::ostream &os, int indent) const {
    123123        os << std::string( indent, ' ' ) << "Sizeof Expression on: ";
     124
     125        if (isType)
     126                type->print(os, indent + 2);
     127        else
     128                expr->print(os, indent + 2);
     129
     130        os << std::endl;
     131        Expression::print( os, indent );
     132}
     133
     134AlignofExpr::AlignofExpr( Expression *expr_, Expression *_aname ) :
     135                Expression( _aname ), expr(expr_), type(0), isType(false) {
     136        add_result( new BasicType( Type::Qualifiers(), BasicType::UnsignedInt ) );
     137}
     138
     139AlignofExpr::AlignofExpr( Type *type_, Expression *_aname ) :
     140                Expression( _aname ), expr(0), type(type_), isType(true) {
     141        add_result( new BasicType( Type::Qualifiers(), BasicType::UnsignedInt ) );
     142}
     143
     144AlignofExpr::AlignofExpr( const AlignofExpr &other ) :
     145        Expression( other ), expr( maybeClone( other.expr ) ), type( maybeClone( other.type ) ), isType( other.isType ) {
     146}
     147
     148AlignofExpr::~AlignofExpr() {
     149        delete expr;
     150        delete type;
     151}
     152
     153void AlignofExpr::print( std::ostream &os, int indent) const {
     154        os << std::string( indent, ' ' ) << "Alignof Expression on: ";
    124155
    125156        if (isType)
Note: See TracChangeset for help on using the changeset viewer.