Ignore:
Timestamp:
Dec 14, 2015, 4:28:46 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, ctor, deferred_resn, demangler, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, string, with_gc
Children:
5e92fee
Parents:
56fcd77
Message:

Initial draft of switch-over of size/align names

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/ScrubTyVars.cc

    r56fcd77 rdb0b3ce  
    1313// Update Count     : 2
    1414//
     15
     16#include <string>
    1517
    1618#include "GenPoly.h"
     
    4244
    4345        Expression * ScrubTyVars::mutate( SizeofExpr *szeof ) {
    44                 // sizeof( T ) => T parameter, which is the size of T
     46                // sizeof( T ) => _sizeof_T parameter, which is the size of T
    4547                if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( szeof->get_type() ) ) {
    46                         Expression *expr = new NameExpr( typeInst->get_name() );
     48                        Expression *expr = new NameExpr( std::string("_sizeof_") + typeInst->get_name() );
    4749                        return expr;
    4850                } else {
    4951                        return Mutator::mutate( szeof );
     52                } // if
     53        }
     54
     55        Expression * ScrubTyVars::mutate( AlignofExpr *algnof ) {
     56                // alignof( T ) => _alignof_T parameter, which is the alignment of T
     57                if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( algnof->get_type() ) ) {
     58                        Expression *expr = new NameExpr( std::string("_alignof_") + typeInst->get_name() );
     59                        return expr;
     60                } else {
     61                        return Mutator::mutate( algnof );
    5062                } // if
    5163        }
Note: See TracChangeset for help on using the changeset viewer.