Ignore:
Timestamp:
Jul 27, 2017, 2:56:39 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
874960b
Parents:
4d4e5de (diff), a04ce4d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ExpressionNode.cc

    r4d4e5de rfcd17b2f  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:17:07 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Tus Jul 18 10:08:00 2017
    13 // Update Count     : 550
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Jul 27 12:10:10 2017
     13// Update Count     : 556
    1414//
    1515
     
    6262        bool dec = true, Unsigned = false;                                      // decimal, unsigned constant
    6363        int size;                                                                                       // 0 => int, 1 => long, 2 => long long
    64         unsigned long long int v;                                                               // converted integral value
     64        unsigned long long int v;                                                       // converted integral value
    6565        size_t last = str.length() - 1;                                         // last character of constant
    66 
     66        Expression * ret;
     67
     68        // special constants
     69        if ( str == "0" ) {
     70                ret = new ConstantExpr( Constant( (Type *)new ZeroType( noQualifiers ), str, (unsigned long long int)0 ) );
     71                goto CLEANUP;
     72        } // if
     73        if ( str == "1" ) {
     74                ret = new ConstantExpr( Constant( (Type *)new OneType( noQualifiers ), str, (unsigned long long int)1 ) );
     75                goto CLEANUP;
     76        } // if
     77       
    6778        if ( str[0] == '0' ) {                                                          // octal/hex constant ?
    6879                dec = false;
     
    118129        } // if
    119130
    120         Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) );
     131        ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) );
     132  CLEANUP:
    121133        delete &str;                                                                            // created by lex
    122134        return ret;
     
    174186        return ret;
    175187} // build_constantStr
    176 
    177 Expression *build_constantZeroOne( const std::string & str ) {
    178         Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( noQualifiers ) : (Type*)new OneType( noQualifiers ), str,
    179                                                                                                    str == "0" ? (unsigned long long int)0 : (unsigned long long int)1 ) );
    180         delete &str;                                                                            // created by lex
    181         return ret;
    182 } // build_constantChar
    183188
    184189Expression * build_field_name_FLOATINGconstant( const std::string & str ) {
     
    252257}
    253258
     259
     260Expression *build_virtual_cast( DeclarationNode *decl_node, ExpressionNode *expr_node ) {
     261        Type *targetType = maybeMoveBuildType( decl_node );
     262        Expression *castArg = maybeMoveBuild< Expression >( expr_node );
     263        return new VirtualCastExpr( castArg, targetType );
     264}
     265
    254266Expression *build_fieldSel( ExpressionNode *expr_node, Expression *member ) {
    255267        UntypedMemberExpr *ret = new UntypedMemberExpr( member, maybeMoveBuild< Expression >(expr_node) );
Note: See TracChangeset for help on using the changeset viewer.