Ignore:
Timestamp:
Jul 19, 2017, 11:49:33 AM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
9cc0472
Parents:
fea3faa (diff), a57cb58 (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/SynTree/Constant.cc

    rfea3faa rb826e6b  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Constant.cc -- 
     7// Constant.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Jun 22 10:11:00 2017
    13 // Update Count     : 28
     12// Last Modified On : Fri Jul 14 14:50:00 2017
     13// Update Count     : 29
    1414//
    1515
     
    4646}
    4747
     48Constant Constant::null( Type * ptrtype ) {
     49        if ( nullptr == ptrtype ) {
     50                ptrtype = new PointerType(
     51                        Type::Qualifiers(),
     52                        new VoidType( Type::Qualifiers() )
     53                        );
     54        }
     55
     56        return Constant( ptrtype, "0", (unsigned long long int)0 );
     57}
     58
     59unsigned long long Constant::get_ival() const {
     60        assertf( safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." );
     61        return val.ival;
     62}
     63
     64double Constant::get_dval() const {
     65        assertf( ! safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." );
     66        return val.dval;
     67}
     68
    4869void Constant::print( std::ostream &os ) const {
    4970        os << "(" << rep << " " << val.ival;
Note: See TracChangeset for help on using the changeset viewer.