Changeset 25bca42 for src/Parser


Ignore:
Timestamp:
Jun 6, 2018, 5:23:49 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
407bde5
Parents:
f083335
Message:

add const qualifier to string pointer parameters

Location:
src/Parser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rf083335 r25bca42  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 22 08:39:29 2018
    13 // Update Count     : 1074
     12// Last Modified On : Wed Jun  6 15:57:50 2018
     13// Update Count     : 1076
    1414//
    1515
     
    174174}
    175175
    176 DeclarationNode * DeclarationNode::newFunction( string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body ) {
     176DeclarationNode * DeclarationNode::newFunction( const string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body ) {
    177177        DeclarationNode * newnode = new DeclarationNode;
    178178        newnode->name = name;
     
    245245} // DeclarationNode::newForall
    246246
    247 DeclarationNode * DeclarationNode::newFromTypedef( string * name ) {
     247DeclarationNode * DeclarationNode::newFromTypedef( const string * name ) {
    248248        DeclarationNode * newnode = new DeclarationNode;
    249249        newnode->type = new TypeData( TypeData::SymbolicInst );
     
    268268} // DeclarationNode::newAggregate
    269269
    270 DeclarationNode * DeclarationNode::newEnum( string * name, DeclarationNode * constants, bool body ) {
     270DeclarationNode * DeclarationNode::newEnum( const string * name, DeclarationNode * constants, bool body ) {
    271271        assert( name );
    272272        DeclarationNode * newnode = new DeclarationNode;
     
    278278} // DeclarationNode::newEnum
    279279
    280 DeclarationNode * DeclarationNode::newEnumConstant( string * name, ExpressionNode * constant ) {
     280DeclarationNode * DeclarationNode::newEnumConstant( const string * name, ExpressionNode * constant ) {
    281281        DeclarationNode * newnode = new DeclarationNode;
    282282        newnode->name = name;
     
    285285} // DeclarationNode::newEnumConstant
    286286
    287 DeclarationNode * DeclarationNode::newName( string * name ) {
     287DeclarationNode * DeclarationNode::newName( const string * name ) {
    288288        DeclarationNode * newnode = new DeclarationNode;
    289289        newnode->name = name;
     
    291291} // DeclarationNode::newName
    292292
    293 DeclarationNode * DeclarationNode::newFromTypeGen( string * name, ExpressionNode * params ) {
     293DeclarationNode * DeclarationNode::newFromTypeGen( const string * name, ExpressionNode * params ) {
    294294        DeclarationNode * newnode = new DeclarationNode;
    295295        newnode->type = new TypeData( TypeData::SymbolicInst );
     
    300300} // DeclarationNode::newFromTypeGen
    301301
    302 DeclarationNode * DeclarationNode::newTypeParam( TypeClass tc, string * name ) {
     302DeclarationNode * DeclarationNode::newTypeParam( TypeClass tc, const string * name ) {
    303303        DeclarationNode * newnode = new DeclarationNode;
    304304        newnode->type = nullptr;
     
    331331} // DeclarationNode::newTraitUse
    332332
    333 DeclarationNode * DeclarationNode::newTypeDecl( string * name, DeclarationNode * typeParams ) {
     333DeclarationNode * DeclarationNode::newTypeDecl( const string * name, DeclarationNode * typeParams ) {
    334334        DeclarationNode * newnode = new DeclarationNode;
    335335        newnode->name = name;
     
    406406} // DeclarationNode::newBuiltinType
    407407
    408 DeclarationNode * DeclarationNode::newAttr( string * name, ExpressionNode * expr ) {
     408DeclarationNode * DeclarationNode::newAttr( const string * name, ExpressionNode * expr ) {
    409409        DeclarationNode * newnode = new DeclarationNode;
    410410        newnode->type = nullptr;
     
    415415}
    416416
    417 DeclarationNode * DeclarationNode::newAttr( string * name, DeclarationNode * type ) {
     417DeclarationNode * DeclarationNode::newAttr( const string * name, DeclarationNode * type ) {
    418418        DeclarationNode * newnode = new DeclarationNode;
    419419        newnode->type = nullptr;
     
    424424}
    425425
    426 DeclarationNode * DeclarationNode::newAttribute( string * name, ExpressionNode * expr ) {
     426DeclarationNode * DeclarationNode::newAttribute( const string * name, ExpressionNode * expr ) {
    427427        DeclarationNode * newnode = new DeclarationNode;
    428428        newnode->type = nullptr;
  • src/Parser/ParseNode.h

    rf083335 r25bca42  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun  4 22:21:04 2018
    13 // Update Count     : 832
     12// Last Modified On : Wed Jun  6 16:17:18 2018
     13// Update Count     : 843
    1414//
    1515
     
    7777
    7878        ParseNode * next = nullptr;
    79         std::string * name = nullptr;
     79        const std::string * name = nullptr;
    8080        CodeLocation location = yylloc;
    8181}; // ParseNode
     
    171171};
    172172
    173 Expression * build_constantInteger( std::string &str );
    174 Expression * build_constantFloat( std::string &str );
    175 Expression * build_constantChar( std::string &str );
    176 Expression * build_constantStr( std::string &str );
     173Expression * build_constantInteger( std::string & str ); // these 4 routines modify the string
     174Expression * build_constantFloat( std::string & str );
     175Expression * build_constantChar( std::string & str );
     176Expression * build_constantStr( std::string & str );
    177177Expression * build_field_name_FLOATING_FRACTIONconstant( const std::string & str );
    178178Expression * build_field_name_FLOATING_DECIMALconstant( const std::string & str );
     
    230230        static DeclarationNode * newBuiltinType( BuiltinType );
    231231        static DeclarationNode * newForall( DeclarationNode * );
    232         static DeclarationNode * newFromTypedef( std::string * );
    233         static DeclarationNode * newFunction( std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body );
     232        static DeclarationNode * newFromTypedef( const std::string * );
     233        static DeclarationNode * newFunction( const std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body );
    234234        static DeclarationNode * newAggregate( Aggregate kind, const std::string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body );
    235         static DeclarationNode * newEnum( std::string * name, DeclarationNode * constants, bool body );
    236         static DeclarationNode * newEnumConstant( std::string * name, ExpressionNode * constant );
    237         static DeclarationNode * newName( std::string * );
    238         static DeclarationNode * newFromTypeGen( std::string *, ExpressionNode * params );
    239         static DeclarationNode * newTypeParam( TypeClass, std::string * );
     235        static DeclarationNode * newEnum( const std::string * name, DeclarationNode * constants, bool body );
     236        static DeclarationNode * newEnumConstant( const std::string * name, ExpressionNode * constant );
     237        static DeclarationNode * newName( const std::string * );
     238        static DeclarationNode * newFromTypeGen( const std::string *, ExpressionNode * params );
     239        static DeclarationNode * newTypeParam( TypeClass, const std::string * );
    240240        static DeclarationNode * newTrait( const std::string * name, DeclarationNode * params, DeclarationNode * asserts );
    241241        static DeclarationNode * newTraitUse( const std::string * name, ExpressionNode * params );
    242         static DeclarationNode * newTypeDecl( std::string * name, DeclarationNode * typeParams );
     242        static DeclarationNode * newTypeDecl( const std::string * name, DeclarationNode * typeParams );
    243243        static DeclarationNode * newPointer( DeclarationNode * qualifiers, OperKinds kind );
    244244        static DeclarationNode * newArray( ExpressionNode * size, DeclarationNode * qualifiers, bool isStatic );
     
    247247        static DeclarationNode * newTuple( DeclarationNode * members );
    248248        static DeclarationNode * newTypeof( ExpressionNode * expr );
    249         static DeclarationNode * newAttr( std::string *, ExpressionNode * expr ); // @ attributes
    250         static DeclarationNode * newAttr( std::string *, DeclarationNode * type ); // @ attributes
    251         static DeclarationNode * newAttribute( std::string *, ExpressionNode * expr = nullptr ); // gcc attributes
     249        static DeclarationNode * newAttr( const std::string *, ExpressionNode * expr ); // @ attributes
     250        static DeclarationNode * newAttr( const std::string *, DeclarationNode * type ); // @ attributes
     251        static DeclarationNode * newAttribute( const std::string *, ExpressionNode * expr = nullptr ); // gcc attributes
    252252        static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement
    253253        static DeclarationNode * newStaticAssert( ExpressionNode * condition, Expression * message );
Note: See TracChangeset for help on using the changeset viewer.