- File:
-
- 1 edited
-
src/Validate/ImplementEnumFunc.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Validate/ImplementEnumFunc.cpp
racb33f15 rc92bdcc 2 2 #include "AST/Pass.hpp" 3 3 #include "AST/TranslationUnit.hpp" 4 #include "CodeGen/OperatorTable.h " // for isCtorDtor, isCtorDtorAssign5 #include "InitTweak/InitTweak.h " // for isAssignment, isCopyConstructor4 #include "CodeGen/OperatorTable.hpp" // for isCtorDtor, isCtorDtorAssign 5 #include "InitTweak/InitTweak.hpp" // for isAssignment, isCopyConstructor 6 6 namespace Validate { 7 7 … … 72 72 ast::DeclWithType* decl = declPtr.get_and_mutate(); 73 73 decl->attributes.push_back(new ast::Attribute("unused")); 74 } 75 76 ast::ObjectDecl* dstParam() const { 77 return new ast::ObjectDecl(getLocation(), "_dst", 78 new ast::ReferenceType(new ast::EnumAttrType( 79 ast::deepCopy(instType)))); 80 } 81 82 ast::ObjectDecl* srcParam() const { 83 return new ast::ObjectDecl( 84 getLocation(), "_src", 85 new ast::EnumAttrType(ast::deepCopy(instType))); 74 86 } 75 87 … … 317 329 } 318 330 331 inline ast::EnumAttrType * getPosnType( const ast::EnumDecl * decl ) { 332 return new ast::EnumAttrType(new ast::EnumInstType(decl), ast::EnumAttribute::Posn); 333 } 334 319 335 ast::ObjectDecl* EnumAttrFuncGenerator::genAttrArrayProto( 320 336 const ast::EnumAttribute attr, const CodeLocation& location, … … 344 360 func->location, 345 361 new ast::VariableExpr( func->location, func->params.front() ), 346 new ast::BasicType( ast::BasicKind::UnsignedInt ), 347 ast::GeneratedFlag::ExplicitCast 348 )}); 362 new ast::EnumAttrType( new ast::EnumInstType(decl), 363 ast::EnumAttribute::Posn))}); 349 364 func->stmts = new ast::CompoundStmt( 350 365 func->location, {new ast::ReturnStmt(func->location, untyped)}); … … 355 370 func->location, 356 371 new ast::VariableExpr(func->location, func->params.front()), 357 new ast:: BasicType( ast::BasicKind::UnsignedInt),358 ast::GeneratedFlag::ExplicitCast);372 new ast::EnumAttrType(new ast::EnumInstType(decl), 373 ast::EnumAttribute::Posn)); 359 374 func->stmts = new ast::CompoundStmt( 360 375 func->location, {new ast::ReturnStmt(func->location, castExpr)});
Note:
See TracChangeset
for help on using the changeset viewer.