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/ParseNode.h

    r1267fb1 r44a81853  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec 13 15:37:33 2016
    13 // Update Count     : 643
     12// Last Modified On : Wed Jan 18 16:20:43 2017
     13// Update Count     : 650
    1414//
    1515
     
    3535class ExpressionNode;
    3636class InitializerNode;
     37class Attribute;
    3738
    3839//##############################################################################
     
    242243        static DeclarationNode * newTuple( DeclarationNode * members );
    243244        static DeclarationNode * newTypeof( ExpressionNode * expr );
    244         static DeclarationNode * newAttr( std::string *, ExpressionNode * expr );
    245         static DeclarationNode * newAttr( std::string *, DeclarationNode * type );
     245        static DeclarationNode * newAttr( std::string *, ExpressionNode * expr ); // @ attributes
     246        static DeclarationNode * newAttr( std::string *, DeclarationNode * type ); // @ attributes
     247        static DeclarationNode * newAttribute( std::string *, ExpressionNode * expr = nullptr ); // gcc attributes
    246248
    247249        DeclarationNode();
     
    316318        LinkageSpec::Spec linkage;
    317319        ConstantExpr *asmName;
    318         std::list< std::string > attributes;
     320        std::list< Attribute * > attributes;
    319321        InitializerNode * initializer;
    320322        bool extension = false;
     
    344346        Statement * build() const { return const_cast<StatementNode*>(this)->stmt.release(); }
    345347
    346         virtual StatementNode * add_label( const std::string * name ) {
    347                 stmt->get_labels().emplace_back( * name );
     348        virtual StatementNode * add_label( const std::string * name, DeclarationNode * attr = nullptr ) {
     349                stmt->get_labels().emplace_back( * name, nullptr, attr ? std::move( attr->attributes ) : std::list< Attribute * > {} );
     350                delete attr;
    348351                delete name;
    349352                return this;
Note: See TracChangeset for help on using the changeset viewer.