Ignore:
Timestamp:
Jan 18, 2017, 4:57:52 PM (8 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, resolv-new, with_gc
Children:
5ded739
Parents:
1267fb1
Message:

first attempt at gcc attributes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r1267fb1 r44a81853  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 13 14:43:38 2016
    13 // Update Count     : 660
     12// Last Modified On : Sat Jan 14 14:36:23 2017
     13// Update Count     : 669
    1414//
    1515
     
    2222#include "TypeData.h"
    2323
     24#include "SynTree/Attribute.h"
    2425#include "SynTree/Declaration.h"
    2526#include "SynTree/Expression.h"
     
    397398}
    398399
     400DeclarationNode * DeclarationNode::newAttribute( string * name, ExpressionNode * expr ) {
     401        DeclarationNode * newnode = new DeclarationNode;
     402        newnode->type = nullptr;
     403        std::list< Expression * > exprs;
     404        buildList( expr, exprs );
     405        newnode->attributes.push_back( new Attribute( *name, exprs ) );
     406        delete name;
     407        return newnode;
     408}
     409
    399410void appendError( string & dst, const string & src ) {
    400411        if ( src.empty() ) return;
     
    435446                storageClass = q->storageClass;
    436447        } // if
     448        attributes.splice( attributes.end(), q->attributes );
    437449        return this;
    438450} // DeclarationNode::copyStorageClasses
     
    958970
    959971        if ( type ) {
    960                 return buildDecl( type, name ? *name : string( "" ), storageClass, maybeBuild< Expression >( bitfieldWidth ), isInline, isNoreturn, linkage, asmName, maybeBuild< Initializer >(initializer) )->set_extension( extension );
     972                return buildDecl( type, name ? *name : string( "" ), storageClass, maybeBuild< Expression >( bitfieldWidth ), isInline, isNoreturn, linkage, asmName, maybeBuild< Initializer >(initializer), attributes )->set_extension( extension );
    961973        } // if
    962974
Note: See TracChangeset for help on using the changeset viewer.