Changeset f6e3e34 for src/Parser
- Timestamp:
- Apr 3, 2018, 11:13:10 AM (7 years ago)
- 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, with_gc
- Children:
- 92fea32
- Parents:
- 3d2b7bc
- Location:
- src/Parser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r3d2b7bc rf6e3e34 71 71 attr.expr = nullptr; 72 72 attr.type = nullptr; 73 74 assert.condition = nullptr; 75 assert.message = nullptr; 73 76 } 74 77 … … 88 91 // asmName, no delete, passed to next stage 89 92 delete initializer; 93 94 delete assert.condition; 95 delete assert.message; 90 96 } 91 97 … … 117 123 newnode->attr.expr = maybeClone( attr.expr ); 118 124 newnode->attr.type = maybeClone( attr.type ); 125 126 newnode->assert.condition = maybeClone( assert.condition ); 127 newnode->assert.message = maybeClone( assert.message ); 119 128 return newnode; 120 129 } // DeclarationNode::clone … … 434 443 return newnode; 435 444 } 445 446 DeclarationNode * DeclarationNode::newStaticAssert( ExpressionNode * condition, Expression * message ) { 447 DeclarationNode * newnode = new DeclarationNode; 448 newnode->assert.condition = condition; 449 newnode->assert.message = message; 450 return newnode; 451 } 452 436 453 437 454 void appendError( string & dst, const string & src ) { … … 1052 1069 } // if 1053 1070 1071 if ( assert.condition ) { 1072 return new StaticAssertDecl( maybeBuild< Expression >( assert.condition ), strict_dynamic_cast< ConstantExpr * >( maybeClone( assert.message ) ) ); 1073 } 1074 1054 1075 // SUE's cannot have function specifiers, either 1055 1076 // -
src/Parser/ParseNode.h
r3d2b7bc rf6e3e34 246 246 static DeclarationNode * newAttribute( std::string *, ExpressionNode * expr = nullptr ); // gcc attributes 247 247 static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement 248 static DeclarationNode * newStaticAssert( ExpressionNode * condition, Expression * message ); 248 249 249 250 DeclarationNode(); … … 313 314 Attr_t attr; 314 315 316 struct StaticAssert_t { 317 ExpressionNode * condition; 318 Expression * message; 319 }; 320 StaticAssert_t assert; 321 315 322 BuiltinType builtin; 316 323 -
src/Parser/parser.yy
r3d2b7bc rf6e3e34 1308 1308 static_assert: 1309 1309 STATICASSERT '(' constant_expression ',' string_literal ')' ';' // C11 1310 { SemanticError( yylloc, "Static assert is currently unimplemented." ); $$ = nullptr; } // FIX ME1310 { $$ = DeclarationNode::newStaticAssert( $3, $5 ); } 1311 1311 1312 1312 // C declaration syntax is notoriously confusing and error prone. Cforall provides its own type, variable and function
Note: See TracChangeset
for help on using the changeset viewer.