Changes in / [a2e758e:0b8bf27]
- Location:
- src/AST
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Attribute.cpp
ra2e758e r0b8bf27 28 28 auto end = name.find_last_not_of('_'); 29 29 if ( begin == std::string::npos || end == std::string::npos ) return ""; 30 30 31 31 // convert to lowercase 32 32 std::string ret; -
src/AST/Attribute.hpp
ra2e758e r0b8bf27 30 30 public: 31 31 std::string name; 32 std::vector<ptr<Expr>> param s;32 std::vector<ptr<Expr>> parameters; 33 33 34 34 Attribute( const std::string & name = "", std::vector<ptr<Expr>> && params = {}) 35 : name( name ), param s( params ) {}35 : name( name ), parameters( params ) {} 36 36 virtual ~Attribute() = default; 37 37 -
src/AST/Convert.cpp
ra2e758e r0b8bf27 1130 1130 const ast::Type * visit( const ast::FunctionType * node ) override final { 1131 1131 auto ty = new FunctionType { 1132 cv( node ), 1132 cv( node ), 1133 1133 (bool)node->isVarArgs 1134 1134 }; … … 1328 1328 auto attr = new Attribute( 1329 1329 node->name, 1330 get<Expression>().acceptL(node->param s)1330 get<Expression>().acceptL(node->parameters) 1331 1331 ); 1332 1332 this->node = attr; … … 1338 1338 // TypeSubstitution is not a node in the old model, so the conversion result wouldn't fit in this->node. 1339 1339 assert( 0 ); 1340 (void)node;1341 1340 return nullptr; 1342 1341 } … … 1410 1409 # define GET_LABELS_V(labels) \ 1411 1410 to<std::vector>::from( make_labels( std::move( labels ) ) ) 1412 1411 1413 1412 static ast::CV::Qualifiers cv( Type * ty ) { return { ty->get_qualifiers().val }; } 1414 1413 … … 1550 1549 1551 1550 virtual void visit( TypeDecl * old ) override final { 1552 if ( inCache( old ) ) return; 1551 if ( inCache( old ) ) return; 1553 1552 auto decl = new ast::TypeDecl{ 1554 1553 old->location, … … 1588 1587 virtual void visit( AsmDecl * old ) override final { 1589 1588 auto decl = new ast::AsmDecl{ 1590 old->location, 1589 old->location, 1591 1590 GET_ACCEPT_1(stmt, AsmStmt) 1592 1591 }; … … 2143 2142 rslt = new ast::ConstantExpr( 2144 2143 old->location, 2145 GET_ACCEPT_1(result, Type), 2146 old->constant.get_value(), 2144 GET_ACCEPT_1(result, Type), 2145 old->constant.get_value(), 2147 2146 (double) old->constant.get_dval() 2148 2147 ); … … 2164 2163 assert(!old->isType); 2165 2164 rslt = new ast::SizeofExpr( 2166 old->location, 2165 old->location, 2167 2166 GET_ACCEPT_1(expr, Expr) 2168 2167 ); … … 2171 2170 assert(old->isType); 2172 2171 rslt = new ast::SizeofExpr( 2173 old->location, 2172 old->location, 2174 2173 GET_ACCEPT_1(type, Type) 2175 2174 ); … … 2185 2184 assert(!old->isType); 2186 2185 rslt = new ast::AlignofExpr( 2187 old->location, 2186 old->location, 2188 2187 GET_ACCEPT_1(expr, Expr) 2189 2188 ); … … 2192 2191 assert(old->isType); 2193 2192 rslt = new ast::AlignofExpr( 2194 old->location, 2193 old->location, 2195 2194 GET_ACCEPT_1(type, Type) 2196 2195 ); … … 2236 2235 GET_ACCEPT_1(arg1, Expr), 2237 2236 GET_ACCEPT_1(arg2, Expr), 2238 old->get_isAnd() ? 2237 old->get_isAnd() ? 2239 2238 ast::LogicalFlag::AndExpr : 2240 2239 ast::LogicalFlag::OrExpr -
src/AST/Expr.cpp
ra2e758e r0b8bf27 345 345 } 346 346 347 TupleAssignExpr::TupleAssignExpr( 347 TupleAssignExpr::TupleAssignExpr( 348 348 const CodeLocation & loc, const Type * result, const StmtExpr * s ) 349 349 : Expr( loc, result ), stmtExpr() { -
src/AST/Pass.impl.hpp
ra2e758e r0b8bf27 1879 1879 1880 1880 VISIT( 1881 maybe_accept( node, &Attribute::param s );1881 maybe_accept( node, &Attribute::parameters ); 1882 1882 ) 1883 1883 -
src/AST/Print.cpp
ra2e758e r0b8bf27 7 7 // Print.cpp -- 8 8 // 9 // Author : Thierry Delisle10 // Created On : Tue May 21 16:20:15 20199 // Author : Thierry Delisle 10 // Created On : Tue May 21 16:20:15 2019 11 11 // Last Modified By : 12 12 // Last Modified On : 13 // Update Count :13 // Update Count : 14 14 // 15 15 … … 21 21 #include "Type.hpp" 22 22 #include "TypeSubstitution.hpp" 23 24 #include "Common/utility.h" // for group_iterate25 23 26 24 using namespace std; … … 157 155 public: 158 156 virtual const ast::DeclWithType * visit( const ast::ObjectDecl * node ) { 159 if ( !node->name.empty() ) os << node->name << ": ";157 if ( !node->name.empty() ) os << node->name << ": "; 160 158 161 159 if ( node->linkage != Linkage::Cforall ) { … … 638 636 639 637 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;649 638 return node; 650 639 } 651 640 652 641 virtual const ast::Init * visit( const ast::SingleInit * node ) { 653 os << "Simple Initializer: ";654 node->value->accept( *this );655 642 return node; 656 643 } 657 644 658 645 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;673 646 return node; 674 647 } 675 648 676 649 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 }698 650 return node; 699 651 } 700 652 701 653 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;709 654 return node; 710 655 } -
src/AST/TypeSubstitution.hpp
ra2e758e r0b8bf27 25 25 #include "Fwd.hpp" // for UniqueId 26 26 #include "ParseNode.hpp" 27 #include "Type.hpp" 27 #include "Type.hpp" 28 28 #include "Common/SemanticError.h" // for SemanticError 29 29 #include "Visitor.hpp" -
src/AST/porting.md
ra2e758e r0b8bf27 110 110 111 111 ## Specific Nodes ## 112 `Attribute`113 * `parameters` => `params`114 115 112 `Decl` 116 113 * `storageClasses` => `storage`
Note: See TracChangeset
for help on using the changeset viewer.