Changeset caab997 for src/InitTweak


Ignore:
Timestamp:
Dec 22, 2017, 4:18:29 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
f64d9bc
Parents:
fc9153d
Message:

Recognize enumerators as constexpr

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.cc

    rfc9153d rcaab997  
    564564                void previsit( ConstantExpr * ) {}
    565565
     566                void previsit( VariableExpr * varExpr ) {
     567                        visit_children = false;
     568
     569                        if ( EnumInstType * inst = dynamic_cast< EnumInstType * >( varExpr->result ) ) {
     570                                long long int value;
     571                                if ( inst->baseEnum->valueOf( varExpr->var, value ) ) {
     572                                        // enumerators are const expr
     573                                        return;
     574                                }
     575                        }
     576                        isConstExpr = false;
     577                }
     578
    566579                bool isConstExpr = true;
    567580        };
Note: See TracChangeset for help on using the changeset viewer.