Changeset 66406f3 for src/Parser
- Timestamp:
- Aug 8, 2022, 5:11:25 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation
- Children:
- d78c238
- Parents:
- df00c78
- Location:
- src/Parser
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
rdf00c78 r66406f3 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jul 14 17:36:57 202113 // Update Count : 11 5412 // Last Modified On : Mon Aug 8 17:07:00 2022 13 // Update Count : 1185 14 14 // 15 15 … … 128 128 if ( name ) { 129 129 os << *name << ": "; 130 } else {131 os << "unnamed: ";132 130 } // if 133 131 … … 154 152 initializer->printOneLine( os ); 155 153 os << " maybe constructed? " << initializer->get_maybeConstructed(); 156 157 } // if 154 } // if 155 156 for ( Attribute * attr: reverseIterate( attributes ) ) { 157 os << string( indent + 2, ' ' ) << "attr " << attr->name.c_str(); 158 } // for 158 159 159 160 os << endl; … … 243 244 newnode->type = new TypeData( TypeData::Aggregate ); 244 245 newnode->type->aggregate.kind = kind; 245 newnode->type->aggregate.name = 246 newnode->type->aggregate.name = name == nullptr ? new string( DeclarationNode::anonymous.newName() ) : name; 246 247 newnode->type->aggregate.actuals = actuals; 247 248 newnode->type->aggregate.fields = fields; … … 518 519 storageClasses |= q->storageClasses; 519 520 520 for ( Attribute * attr: reverseIterate( q->attributes ) ) {521 for ( Attribute * attr: reverseIterate( q->attributes ) ) { 521 522 attributes.push_front( attr->clone() ); 522 523 } // for … … 683 684 } // if 684 685 delete o; 686 685 687 return this; 686 688 } -
src/Parser/TypeData.cc
rdf00c78 r66406f3 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:12:51 2015 11 // Last Modified By : Henry Xue12 // Last Modified On : Tue Jul 20 04:10:50 202113 // Update Count : 67 311 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 10 22:36:52 2022 13 // Update Count : 677 14 14 // 15 15 … … 283 283 if ( signedness != DeclarationNode::NoSignedness ) os << DeclarationNode::signednessNames[ signedness ] << " "; 284 284 if ( length != DeclarationNode::NoLength ) os << DeclarationNode::lengthNames[ length ] << " "; 285 if ( complextype == DeclarationNode::NoComplexType ) { // basic type 286 assert( basictype != DeclarationNode::NoBasicType ); 287 os << DeclarationNode::basicTypeNames[ basictype ] << " "; 288 } else { // complex type 289 // handle double _Complex 290 if ( basictype != DeclarationNode::NoBasicType ) os << DeclarationNode::basicTypeNames[ basictype ] << " "; 291 os << DeclarationNode::complexTypeNames[ complextype ] << " "; 292 } // if 285 if ( complextype != DeclarationNode::NoComplexType ) os << DeclarationNode::complexTypeNames[ complextype ] << " "; 286 if ( basictype != DeclarationNode::NoBasicType ) os << DeclarationNode::basicTypeNames[ basictype ] << " "; 293 287 break; 294 288 case Pointer: … … 437 431 __attribute__((fallthrough)); 438 432 #endif 433 // FALL THROUGH 439 434 case Typeof: 440 435 os << "type-of expression "; … … 442 437 typeexpr->print( os, indent + 2 ); 443 438 } // if 439 break; 440 case Vtable: 441 os << "vtable"; 444 442 break; 445 443 case Builtin: -
src/Parser/TypeData.h
rdf00c78 r66406f3 10 10 // Created On : Sat May 16 15:18:36 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jul 14 17:44:05 202113 // Update Count : 20 212 // Last Modified On : Tue May 10 22:18:49 2022 13 // Update Count : 203 14 14 // 15 15 … … 27 27 struct TypeData { 28 28 enum Kind { Basic, Pointer, Reference, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic, 29 SymbolicInst, Tuple, Typeof, Basetypeof, Vtable, Builtin, GlobalScope, Qualified, Unknown };29 SymbolicInst, Tuple, Basetypeof, Typeof, Vtable, Builtin, GlobalScope, Qualified, Unknown }; 30 30 31 31 struct Aggregate_t { -
src/Parser/TypedefTable.cc
rdf00c78 r66406f3 10 10 // Created On : Sat May 16 15:20:13 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 19 08:30:14 202113 // Update Count : 2 6212 // Last Modified On : Tue Feb 15 08:27:24 2022 13 // Update Count : 275 14 14 // 15 15 … … 18 18 #include <cassert> // for assert 19 19 #include <iostream> 20 using namespace std; 20 21 21 22 #if 0 … … 28 29 29 30 debugPrint( 30 static const char *kindName( int kind ) {31 switch ( kind ) {32 case IDENTIFIER: return "identifier";33 case TYPEDIMname: return "typedim";34 case TYPEDEFname: return "typedef";35 case TYPEGENname: return "typegen";36 default:37 cerr << "Error: cfa-cpp internal error, invalid kind of identifier" << endl;38 abort();39 } // switch40 } // kindName41 ) 31 static const char *kindName( int kind ) { 32 switch ( kind ) { 33 case IDENTIFIER: return "identifier"; 34 case TYPEDIMname: return "typedim"; 35 case TYPEDEFname: return "typedef"; 36 case TYPEGENname: return "typegen"; 37 default: 38 cerr << "Error: cfa-cpp internal error, invalid kind of identifier" << endl; 39 abort(); 40 } // switch 41 } // kindName 42 ); 42 43 43 44 TypedefTable::~TypedefTable() { … … 80 81 81 82 void TypedefTable::addToScope( const string & identifier, int kind, const char * locn __attribute__((unused)) ) { 82 autoscope = kindTable.currentScope();83 KindTable::size_type scope = kindTable.currentScope(); 83 84 debugPrint( cerr << "Adding current at " << locn << " " << identifier << " as " << kindName( kind ) << " scope " << scope << endl ); 84 85 kindTable.insertAt( scope, identifier, kind ); … … 86 87 87 88 void TypedefTable::addToEnclosingScope( const string & identifier, int kind, const char * locn __attribute__((unused)) ) { 88 autoscope = kindTable.currentScope() - 1 - kindTable.getNote( kindTable.currentScope() - 1 ).level;89 // autoscope = level - kindTable.getNote( kindTable.currentScope() - 1 ).level;89 KindTable::size_type scope = kindTable.currentScope() - 1 - kindTable.getNote( kindTable.currentScope() - 1 ).level; 90 // size_type scope = level - kindTable.getNote( kindTable.currentScope() - 1 ).level; 90 91 debugPrint( cerr << "Adding enclosing at " << locn << " " << identifier << " as " << kindName( kind ) << " scope " << scope << " level " << level << " note " << kindTable.getNote( kindTable.currentScope() - 1 ).level << endl ); 91 autoret = kindTable.insertAt( scope, identifier, kind );92 pair< KindTable::iterator, bool > ret = kindTable.insertAt( scope, identifier, kind ); 92 93 if ( ! ret.second ) ret.first->second = kind; // exists => update 93 94 } // TypedefTable::addToEnclosingScope
Note: See TracChangeset
for help on using the changeset viewer.