Changeset 9a19608 for src/AST/Type.hpp


Ignore:
Timestamp:
Jun 4, 2019, 4:49:30 PM (5 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
9519aba
Parents:
1867c96 (diff), de8dfac2 (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/AST/Type.hpp

    r1867c96 r9a19608  
    7777};
    7878
    79 /// Set the `is_lvalue` qualifier on this type, cloning only if necessary
     79/// Clear/reset the qualifiers on this type, cloning only if necessary
    8080template< enum Node::ref_type ref_t >
    81 void add_lvalue( ptr_base< Type, ref_t > & p ) {
    82         if ( ! p->qualifiers.is_lvalue ) p.get_and_mutate()->qualifiers.is_lvalue = true;
     81void reset_qualifiers( ptr_base< Type, ref_t > & p, CV::Qualifiers q = {} ) {
     82        if ( p->qualifiers.val != q.val ) p.get_and_mutate()->qualifiers = q;
    8383}
    8484
    85 /// Clear the qualifiers on this type, cloning only if necessary
     85/// Add the specified qualifiers to this type, cloning only if necessary
    8686template< enum Node::ref_type ref_t >
    87 void clear_qualifiers( ptr_base< Type, ref_t > & p ) {
    88         if ( p->qualifiers != CV::Qualifiers{} ) p.get_and_mutate()->qualifiers = CV::Qualifiers{};
     87void add_qualifiers( ptr_base< Type, ref_t > & p, CV::Qualifiers q ) {
     88        if ( ( p->qualifiers.val & q.val ) != q.val ) p.get_and_mutate()->qualifiers |= q;
     89}
     90
     91/// Remove the specified qualifiers from this type, cloning only if necessary
     92template< enum Node::ref_type ref_t >
     93void remove_qualifiers( ptr_base< Type, ref_t > & p, CV::Qualifiers q ) {
     94        if ( ( p->qualifiers.val & q.val ) != 0 ) p.get_and_mutate()->qualifiers -= q;
    8995}
    9096
Note: See TracChangeset for help on using the changeset viewer.