Ignore:
Timestamp:
Oct 15, 2020, 9:41:31 PM (4 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
afe2939
Parents:
0b18db7
Message:

Expanding earlier #182 fix to another case of the same issue. Fixes #224?

There is now a reusable helper function addDataSectonAttribute that applies the fix to an ObjectDecl? when we realize it needs it. Test const-init is expanded with case of #224.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.cc

    r0b18db7 rf1791a4  
    10551055                return isCopyFunction( decl, "?{}" );
    10561056        }
     1057
     1058        void addDataSectonAttribute( ObjectDecl * objDecl ) {
     1059                Type *strLitT = new PointerType( Type::Qualifiers( ),
     1060                        new BasicType( Type::Qualifiers( ), BasicType::Char ) );
     1061                std::list< Expression * > attr_params;
     1062                attr_params.push_back(
     1063                        new ConstantExpr( Constant( strLitT, "\".data#\"", std::nullopt ) ) );
     1064                objDecl->attributes.push_back(new Attribute("section", attr_params));
     1065        }
     1066
    10571067}
Note: See TracChangeset for help on using the changeset viewer.