Changeset 367e082 for src


Ignore:
Timestamp:
May 25, 2015, 3:15:21 PM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
49205cf
Parents:
53a2e97
Message:

generated assignment routine will not attempt to assign to a const array field

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r53a2e97 r367e082  
    1010// Created On       : Sun May 17 21:50:04 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Fri May 22 15:29:16 2015
    13 // Update Count     : 9
     12// Last Modified On : Mon May 25 14:27:15 2015
     13// Update Count     : 21
    1414//
    1515
     
    560560                for ( std::list< Declaration * >::const_iterator member = aggregateDecl->get_members().begin(); member != aggregateDecl->get_members().end(); ++member ) {
    561561                        if ( DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( *member ) ) {
    562                                 Type::Qualifiers & qualifiers = dwt->get_type()->get_qualifiers();
    563                                 if ( qualifiers.isConst ) {
     562                                // query the type qualifiers of this field and skip assigning it if it is marked const.
     563                                // If it is an array type, we need to strip off the array layers to find its qualifiers.
     564                                Type * type = dwt->get_type();
     565                                while ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) {
     566                                        type = at->get_base();
     567                                }
     568
     569                                if ( type->get_qualifiers().isConst ) {
    564570                                        // don't assign const members
    565571                                        continue;
  • src/SynTree/Declaration.h

    r53a2e97 r367e082  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 <<<<<<< Updated upstream
    1211// Last Modified By : Rob Schluntz
    13 // Last Modified On : Mon May 25 13:54:32 2015
    14 =======
    15 // Last Modified By : Rob Schluntz
    16 // Last Modified On : Thu May 21 16:27:31 2015
    17 >>>>>>> Stashed changes
    18 // Update Count     : 5
     12// Last Modified On : Mon May 25 14:08:10 2015
     13// Update Count     : 6
    1914//
    2015
Note: See TracChangeset for help on using the changeset viewer.