Ignore:
Timestamp:
Apr 12, 2021, 11:53:30 AM (3 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
73f4d08
Parents:
ecfd758
Message:

Added and used some helpers. The widely useful one is a from_string helper for constants.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Virtual/Tables.cc

    recfd758 rb91bfde  
    172172
    173173Attribute * linkonce( const std::string & subsection ) {
    174         const std::string section = "\".gnu.linkonce." + subsection + "\"";
    175         // Adjust for terminator and quotes.
    176         size_t str_size = section.size() + 1 - 2;
     174        const std::string section = ".gnu.linkonce." + subsection;
    177175        return new Attribute( "section", {
    178                 new ConstantExpr( Constant(
    179                         new ArrayType(
    180                                 noQualifiers,
    181                                 new BasicType( noQualifiers, BasicType::Char ),
    182                                 new ConstantExpr( Constant::from_ulong( str_size ) ),
    183                                 false, false ),
    184                         section,
    185                         std::nullopt
    186                 ) ),
     176                new ConstantExpr( Constant::from_string( section ) ),
    187177        } );
    188178}
Note: See TracChangeset for help on using the changeset viewer.