Changeset c2cf2d0


Ignore:
Timestamp:
Jul 5, 2024, 11:43:23 AM (3 days ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
550afde2
Parents:
8c55d34
Message:

Made string literals constants. Preformed required updates. Resisted preforming large refactoring.

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.cpp

    r8c55d34 rc2cf2d0  
    261261
    262262ConstantExpr * ConstantExpr::from_string( const CodeLocation & loc, const std::string & str ) {
    263         const Type * charType = new BasicType( BasicKind::Char );
     263        const Type * charType = new BasicType( BasicKind::Char, ast::CV::Const );
    264264        // Adjust the length of the string for the terminator.
    265265        const Expr * strSize = from_ulong( loc, str.size() + 1 );
  • src/Validate/ImplementEnumFunc.cpp

    r8c55d34 rc2cf2d0  
    187187                {new ast::ObjectDecl(
    188188                        getLocation(), "_ret",
    189                         new ast::PointerType(new ast::BasicType{ast::BasicKind::Char}))});
     189                        new ast::PointerType(
     190                                new ast::BasicType(ast::BasicKind::Char, ast::CV::Const)))});
    190191}
    191192
     
    231232                {new ast::ObjectDecl(
    232233                        getLocation(), "_ret",
    233                         new ast::PointerType(new ast::BasicType{ast::BasicKind::Char}))});
     234                        new ast::PointerType(
     235                                new ast::BasicType(ast::BasicKind::Char, ast::CV::Const)))});
    234236}
    235237
     
    343345                attr == ast::EnumAttribute::Value
    344346                        ? decl->base
    345                         : new ast::PointerType(new ast::BasicType{ast::BasicKind::Char}),
     347                        : new ast::PointerType(
     348                                new ast::BasicType(ast::BasicKind::Char, ast::CV::Const)),
    346349                ast::ConstantExpr::from_int(decl->location, decl->members.size()),
    347350                ast::LengthFlag::FixedLen, ast::DimensionFlag::DynamicDim);
Note: See TracChangeset for help on using the changeset viewer.