Changes in / [0b8bf27:a2e758e]


Ignore:
Location:
src/AST
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Attribute.cpp

    r0b8bf27 ra2e758e  
    2828        auto end = name.find_last_not_of('_');
    2929        if ( begin == std::string::npos || end == std::string::npos ) return "";
    30        
     30
    3131        // convert to lowercase
    3232        std::string ret;
  • src/AST/Attribute.hpp

    r0b8bf27 ra2e758e  
    3030public:
    3131        std::string name;
    32         std::vector<ptr<Expr>> parameters;
     32        std::vector<ptr<Expr>> params;
    3333
    3434        Attribute( const std::string & name = "", std::vector<ptr<Expr>> && params = {})
    35         : name( name ), parameters( params ) {}
     35        : name( name ), params( params ) {}
    3636        virtual ~Attribute() = default;
    3737
  • src/AST/Convert.cpp

    r0b8bf27 ra2e758e  
    11301130        const ast::Type * visit( const ast::FunctionType * node ) override final {
    11311131                auto ty = new FunctionType {
    1132                         cv( node ), 
     1132                        cv( node ),
    11331133                        (bool)node->isVarArgs
    11341134                };
     
    13281328                auto attr = new Attribute(
    13291329                        node->name,
    1330                         get<Expression>().acceptL(node->parameters)
     1330                        get<Expression>().acceptL(node->params)
    13311331                );
    13321332                this->node = attr;
     
    13381338                // TypeSubstitution is not a node in the old model, so the conversion result wouldn't fit in this->node.
    13391339                assert( 0 );
     1340                (void)node;
    13401341                return nullptr;
    13411342        }
     
    14091410#       define GET_LABELS_V(labels) \
    14101411                to<std::vector>::from( make_labels( std::move( labels ) ) )
    1411        
     1412
    14121413        static ast::CV::Qualifiers cv( Type * ty ) { return { ty->get_qualifiers().val }; }
    14131414
     
    15491550
    15501551        virtual void visit( TypeDecl * old ) override final {
    1551                 if ( inCache( old ) ) return;   
     1552                if ( inCache( old ) ) return;
    15521553                auto decl = new ast::TypeDecl{
    15531554                        old->location,
     
    15871588        virtual void visit( AsmDecl * old ) override final {
    15881589                auto decl = new ast::AsmDecl{
    1589                         old->location, 
     1590                        old->location,
    15901591                        GET_ACCEPT_1(stmt, AsmStmt)
    15911592                };
     
    21422143                        rslt = new ast::ConstantExpr(
    21432144                                old->location,
    2144                                 GET_ACCEPT_1(result, Type), 
    2145                                 old->constant.get_value(), 
     2145                                GET_ACCEPT_1(result, Type),
     2146                                old->constant.get_value(),
    21462147                                (double) old->constant.get_dval()
    21472148                        );
     
    21632164                        assert(!old->isType);
    21642165                        rslt = new ast::SizeofExpr(
    2165                                 old->location, 
     2166                                old->location,
    21662167                                GET_ACCEPT_1(expr, Expr)
    21672168                        );
     
    21702171                        assert(old->isType);
    21712172                        rslt = new ast::SizeofExpr(
    2172                                 old->location, 
     2173                                old->location,
    21732174                                GET_ACCEPT_1(type, Type)
    21742175                        );
     
    21842185                        assert(!old->isType);
    21852186                        rslt = new ast::AlignofExpr(
    2186                                 old->location, 
     2187                                old->location,
    21872188                                GET_ACCEPT_1(expr, Expr)
    21882189                        );
     
    21912192                        assert(old->isType);
    21922193                        rslt = new ast::AlignofExpr(
    2193                                 old->location, 
     2194                                old->location,
    21942195                                GET_ACCEPT_1(type, Type)
    21952196                        );
     
    22352236                                GET_ACCEPT_1(arg1, Expr),
    22362237                                GET_ACCEPT_1(arg2, Expr),
    2237                                 old->get_isAnd() ? 
     2238                                old->get_isAnd() ?
    22382239                                        ast::LogicalFlag::AndExpr :
    22392240                                        ast::LogicalFlag::OrExpr
  • src/AST/Expr.cpp

    r0b8bf27 ra2e758e  
    345345}
    346346
    347 TupleAssignExpr::TupleAssignExpr( 
     347TupleAssignExpr::TupleAssignExpr(
    348348        const CodeLocation & loc, const Type * result, const StmtExpr * s )
    349349: Expr( loc, result ), stmtExpr() {
  • src/AST/Pass.impl.hpp

    r0b8bf27 ra2e758e  
    18791879
    18801880        VISIT(
    1881                 maybe_accept( node, &Attribute::parameters );
     1881                maybe_accept( node, &Attribute::params );
    18821882        )
    18831883
  • src/AST/Print.cpp

    r0b8bf27 ra2e758e  
    77// Print.cpp --
    88//
    9 // Author           : Thierry Delisle
    10 // Created On       : Tue May 21 16:20:15 2019
     9// Author : Thierry Delisle
     10// Created On : Tue May 21 16:20:15 2019
    1111// Last Modified By :
    1212// Last Modified On :
    13 // Update Count     :
     13// Update Count :
    1414//
    1515
     
    2121#include "Type.hpp"
    2222#include "TypeSubstitution.hpp"
     23
     24#include "Common/utility.h" // for group_iterate
    2325
    2426using namespace std;
     
    155157public:
    156158        virtual const ast::DeclWithType * visit( const ast::ObjectDecl * node ) {
    157                 if (  !node->name.empty() ) os << node->name << ": ";
     159                if ( !node->name.empty() ) os << node->name << ": ";
    158160
    159161                if ( node->linkage != Linkage::Cforall ) {
     
    636638
    637639        virtual const ast::Designation * visit( const ast::Designation * node ) {
     640                if ( node->designators.empty() ) return node;
     641                os << "... designated by: " << std::endl;
     642                ++indent;
     643                for ( const ast::Expr * d : node->designators ) {
     644                        os << indent;
     645                        d->accept( *this );
     646                        os << std::endl;
     647                }
     648                --indent;
    638649                return node;
    639650        }
    640651
    641652        virtual const ast::Init * visit( const ast::SingleInit * node ) {
     653                os << "Simple Initializer: ";
     654                node->value->accept( *this );
    642655                return node;
    643656        }
    644657
    645658        virtual const ast::Init * visit( const ast::ListInit * node ) {
     659                os << "Compound initializer: " << std::endl;
     660                ++indent;
     661                for ( auto p : group_iterate( node->designations, node->initializers ) ) {
     662                        const ast::Designation * d = std::get<0>(p);
     663                        const ast::Init * init = std::get<1>(p);
     664                        os << indent;
     665                        init->accept( *this );
     666                        os << std::endl;
     667                        if ( ! d->designators.empty() ) {
     668                                os << indent;
     669                                d->accept( *this );
     670                        }
     671                }
     672                --indent;
    646673                return node;
    647674        }
    648675
    649676        virtual const ast::Init * visit( const ast::ConstructorInit * node ) {
     677                os << "Constructor initializer: " << std::endl;
     678                if ( node->ctor ) {
     679                        os << indent << "... initially constructed with ";
     680                        ++indent;
     681                        node->ctor->accept( *this );
     682                        --indent;
     683                }
     684
     685                if ( node->dtor ) {
     686                        os << indent << "... destructed with ";
     687                        ++indent;
     688                        node->dtor->accept( *this );
     689                        --indent;
     690                }
     691
     692                if ( node->init ) {
     693                        os << indent << "... with fallback C-style initializer: ";
     694                        ++indent;
     695                        node->init->accept( *this );
     696                        --indent;
     697                }
    650698                return node;
    651699        }
    652700
    653701        virtual const ast::Attribute * visit( const ast::Attribute * node ) {
     702                if ( node->empty() ) return node;
     703                os << "Attribute with name: " << node->name;
     704                if ( node->params.empty() ) return node;
     705                os << " with parameters: " << std::endl;
     706                ++indent;
     707                printAll( node->params );
     708                --indent;
    654709                return node;
    655710        }
  • src/AST/TypeSubstitution.hpp

    r0b8bf27 ra2e758e  
    2525#include "Fwd.hpp"        // for UniqueId
    2626#include "ParseNode.hpp"
    27 #include "Type.hpp"       
     27#include "Type.hpp"
    2828#include "Common/SemanticError.h"  // for SemanticError
    2929#include "Visitor.hpp"
  • src/AST/porting.md

    r0b8bf27 ra2e758e  
    110110
    111111## Specific Nodes ##
     112`Attribute`
     113* `parameters` => `params`
     114
    112115`Decl`
    113116* `storageClasses` => `storage`
Note: See TracChangeset for help on using the changeset viewer.