Ignore:
Timestamp:
Apr 19, 2018, 5:54:41 PM (7 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, with_gc
Children:
8633f060
Parents:
e16294d (diff), da9d79b (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/Expression.cc

    re16294d rb03eed6  
    271271}
    272272
    273 CastExpr::CastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) {
     273CastExpr::CastExpr( Expression *arg, Type *toType, bool isGenerated ) : Expression(), arg(arg), isGenerated( isGenerated ) {
    274274        set_result(toType);
    275275}
    276276
    277 CastExpr::CastExpr( Expression *arg_ ) : Expression(), arg(arg_) {
     277CastExpr::CastExpr( Expression *arg, bool isGenerated ) : Expression(), arg(arg), isGenerated( isGenerated ) {
    278278        set_result( new VoidType( Type::Qualifiers() ) );
    279279}
    280280
    281 CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) {
     281CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ) {
    282282}
    283283
     
    296296                result->print( os, indent+1 );
    297297        } // if
     298        Expression::print( os, indent );
     299}
     300
     301KeywordCastExpr::KeywordCastExpr( Expression *arg, Target target ) : Expression(), arg(arg), target( target ) {
     302}
     303
     304KeywordCastExpr::KeywordCastExpr( const KeywordCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), target( other.target ) {
     305}
     306
     307KeywordCastExpr::~KeywordCastExpr() {
     308        delete arg;
     309}
     310
     311const std::string & KeywordCastExpr::targetString() const {
     312        static const std::string targetStrs[] = {
     313                "coroutine", "thread", "monitor"
     314        };
     315        static_assert(
     316                (sizeof(targetStrs) / sizeof(targetStrs[0])) == ((unsigned long)NUMBER_OF_TARGETS),
     317                "Each KeywordCastExpr::Target should have a corresponding string representation"
     318        );
     319        return targetStrs[(unsigned long)target];
     320}
     321
     322void KeywordCastExpr::print( std::ostream &os, Indenter indent ) const {
     323        os << "Keyword Cast of:" << std::endl << indent+1;
     324        arg->print(os, indent+1);
     325        os << std::endl << indent << "... to: ";
     326        os << targetString();
    298327        Expression::print( os, indent );
    299328}
Note: See TracChangeset for help on using the changeset viewer.