Ignore:
Timestamp:
Dec 15, 2015, 2:56:43 PM (9 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:
4389966, ffad73a
Parents:
5e92fee
Message:

Switched size/align parameters over to use SymTab::Mangler in preparation for addition of generic types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/ScrubTyVars.cc

    r5e92fee r78dd0da  
    1414//
    1515
     16#include <sstream>
    1617#include <string>
    1718
    1819#include "GenPoly.h"
    1920#include "ScrubTyVars.h"
     21
     22#include "SymTab/Mangler.h"
    2023
    2124#include "SynTree/Mutator.h"
     
    4649                // sizeof( T ) => _sizeof_T parameter, which is the size of T
    4750                if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( szeof->get_type() ) ) {
    48                         Expression *expr = new NameExpr( std::string("_sizeof_") + typeInst->get_name() );
     51                        Expression *expr = new NameExpr( sizeofName( typeInst ) );
    4952                        return expr;
    5053                } else {
     
    5659                // alignof( T ) => _alignof_T parameter, which is the alignment of T
    5760                if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( algnof->get_type() ) ) {
    58                         Expression *expr = new NameExpr( std::string("_alignof_") + typeInst->get_name() );
     61                        Expression *expr = new NameExpr( alignofName( typeInst ) );
    5962                        return expr;
    6063                } else {
     
    7578                return Mutator::mutate( pointer );
    7679        }
     80       
     81        std::string sizeofName( Type *ty ) {
     82                return std::string( "_sizeof_" ) + SymTab::Mangler::mangle( ty, false, false );
     83        }
     84
     85        std::string alignofName( Type *ty ) {
     86                return std::string( "_alignof_" ) + SymTab::Mangler::mangle( ty, false, false );
     87        }
    7788} // namespace GenPoly
    7889
Note: See TracChangeset for help on using the changeset viewer.