- Timestamp:
- Oct 28, 2019, 4:28:37 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 8364209
- Parents:
- c921712 (diff), 9bdb8b7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src
- Files:
-
- 2 deleted
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
rc921712 rc3a2007 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Thr May 2 10:47:00201913 // Update Count : 49711 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Oct 19 19:30:38 2019 13 // Update Count : 506 14 14 // 15 15 #include "CodeGenerator.h" … … 198 198 // deleted decls should never be used, so don't print them 199 199 if ( objectDecl->isDeleted && options.genC ) return; 200 if (objectDecl->get_name().empty() && options.genC ) { 200 201 // gcc allows an empty declarator (no name) for bit-fields and C states: 6.7.2.1 Structure and union specifiers, 202 // point 4, page 113: If the (bit field) value is zero, the declaration shall have no declarator. For anything 203 // else, the anonymous name refers to the anonymous object for plan9 inheritance. 204 if ( objectDecl->get_name().empty() && options.genC && ! objectDecl->get_bitfieldWidth() ) { 201 205 // only generate an anonymous name when generating C code, otherwise it clutters the output too much 202 206 static UniqueName name = { "__anonymous_object" }; 203 207 objectDecl->set_name( name.newName() ); 204 205 206 207 208 // Stops unused parameter warnings. 209 if ( options.anonymousUnused ) { 210 objectDecl->attributes.push_back( new Attribute( "unused" ) ); 211 } 208 212 } 209 213 -
src/CodeGen/GenType.cc
rc921712 rc3a2007 335 335 typeString = "_Atomic " + typeString; 336 336 } // if 337 if ( type->get_lvalue() && ! options.genC ) {338 // when not generating C code, print lvalue for debugging.339 typeString = "lvalue " + typeString;340 }341 337 } 342 338 } // namespace CodeGen -
src/ControlStruct/MLEMutator.cc
rc921712 rc3a2007 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Mar 8 17:08:25 201813 // Update Count : 2 1912 // Last Modified On : Tue Oct 22 17:22:44 2019 13 // Update Count : 220 14 14 // 15 15 … … 313 313 } 314 314 315 void MLEMutator::premutate( TryStmt * tryStmt ) { 316 // generate a label for breaking out of a labeled if 317 bool labeledBlock = !(tryStmt->get_labels().empty()); 318 if ( labeledBlock ) { 319 Label brkLabel = generator->newLabel("blockBreak", tryStmt); 320 enclosingControlStructures.push_back( Entry( tryStmt, brkLabel ) ); 321 GuardAction( [this]() { enclosingControlStructures.pop_back(); } ); 322 } // if 323 } 324 325 Statement * MLEMutator::postmutate( TryStmt * tryStmt ) { 326 bool labeledBlock = !(tryStmt->get_labels().empty()); 327 if ( labeledBlock ) { 328 if ( ! enclosingControlStructures.back().useBreakExit().empty() ) { 329 set_breakLabel( enclosingControlStructures.back().useBreakExit() ); 330 } // if 331 } // if 332 return tryStmt; 333 } 334 315 335 void MLEMutator::premutate( CaseStmt *caseStmt ) { 316 336 visit_children = false; -
src/ControlStruct/MLEMutator.h
rc921712 rc3a2007 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Mar 8 16:42:32 201813 // Update Count : 4 112 // Last Modified On : Tue Oct 22 17:22:47 2019 13 // Update Count : 45 14 14 // 15 15 … … 47 47 void premutate( SwitchStmt *switchStmt ); 48 48 Statement * postmutate( SwitchStmt *switchStmt ); 49 void premutate( TryStmt *tryStmt ); 50 Statement * postmutate( TryStmt *tryStmt ); 49 51 50 52 Statement *mutateLoop( Statement *bodyLoop, Entry &e ); … … 73 75 explicit Entry( SwitchStmt *stmt, Label breakExit, Label fallDefaultExit ) : 74 76 stmt( stmt ), breakExit( breakExit ), fallDefaultExit( fallDefaultExit ) {} 77 78 explicit Entry( TryStmt *stmt, Label breakExit ) : 79 stmt( stmt ), breakExit( breakExit ) {} 75 80 76 81 bool operator==( const Statement *other ) { return stmt == other; } -
src/GenPoly/Box.cc
rc921712 rc3a2007 837 837 deref->args.push_back( new CastExpr( new VariableExpr( param ), new PointerType( Type::Qualifiers(), arg->get_type()->clone() ) ) ); 838 838 deref->result = arg->get_type()->clone(); 839 deref->result->set_lvalue( true );840 839 return deref; 841 840 } // if -
src/GenPoly/Lvalue.cc
rc921712 rc3a2007 54 54 delete ret->result; 55 55 ret->result = base->clone(); 56 ret->result->set_lvalue( true );57 56 return ret; 58 57 } else { … … 167 166 ReferenceType * result = strict_dynamic_cast< ReferenceType * >( appExpr->result ); 168 167 appExpr->result = result->base->clone(); 169 appExpr->result->set_lvalue( true );170 168 if ( ! inIntrinsic ) { 171 169 // when not in an intrinsic function, add a cast to … … 436 434 delete ret->result; 437 435 ret->result = castExpr->result; 438 ret->result->set_lvalue( true); // ensure result is lvalue436 assert( ret->get_lvalue() ); // ensure result is lvalue 439 437 castExpr->env = nullptr; 440 438 castExpr->arg = nullptr; -
src/Makefile.in
rc921712 rc3a2007 231 231 SynTree/Initializer.$(OBJEXT) \ 232 232 SynTree/TypeSubstitution.$(OBJEXT) SynTree/Attribute.$(OBJEXT) \ 233 SynTree/DeclReplacer.$(OBJEXT) SynTree/TopLvalue.$(OBJEXT)233 SynTree/DeclReplacer.$(OBJEXT) 234 234 am__objects_8 = CompilationState.$(OBJEXT) $(am__objects_1) \ 235 235 $(am__objects_2) Concurrency/Keywords.$(OBJEXT) \ … … 411 411 CCDEPMODE = @CCDEPMODE@ 412 412 CFACC = @CFACC@ 413 CFACC_INSTALL = @CFACC_INSTALL@ 413 414 CFACPP = @CFACPP@ 414 415 CFA_BACKEND_CC = @CFA_BACKEND_CC@ … … 695 696 SynTree/TypeSubstitution.cc \ 696 697 SynTree/Attribute.cc \ 697 SynTree/DeclReplacer.cc \ 698 SynTree/TopLvalue.cc 698 SynTree/DeclReplacer.cc 699 699 700 700 … … 1025 1025 SynTree/DeclReplacer.$(OBJEXT): SynTree/$(am__dirstamp) \ 1026 1026 SynTree/$(DEPDIR)/$(am__dirstamp) 1027 SynTree/TopLvalue.$(OBJEXT): SynTree/$(am__dirstamp) \1028 SynTree/$(DEPDIR)/$(am__dirstamp)1029 1027 Tuples/$(am__dirstamp): 1030 1028 @$(MKDIR_P) Tuples … … 1337 1335 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/ReferenceType.Po@am__quote@ 1338 1336 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/Statement.Po@am__quote@ 1339 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TopLvalue.Po@am__quote@1340 1337 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TupleExpr.Po@am__quote@ 1341 1338 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/TupleType.Po@am__quote@ -
src/ResolvExpr/ConversionCost.cc
rc921712 rc3a2007 157 157 if ( typesCompatibleIgnoreQualifiers( src, destAsRef->base, indexer, env ) ) { 158 158 PRINT( std::cerr << "converting compatible base type" << std::endl; ) 159 assert( src->get_lvalue() == srcIsLvalue );160 159 if ( srcIsLvalue ) { 161 160 PRINT( -
src/ResolvExpr/ResolveAssertions.cc
rc921712 rc3a2007 156 156 for ( const auto& assn : x.assns ) { 157 157 // compute conversion cost from satisfying decl to assertion 158 assert( !assn.match.adjType->get_lvalue() );159 158 k += computeConversionCost( 160 159 assn.match.adjType, assn.decl->get_type(), false, indexer, x.env ); -
src/SymTab/Autogen.h
rc921712 rc3a2007 97 97 // type->get_qualifiers() = Type::Qualifiers(); 98 98 Type * castType = addCast->clone(); 99 castType->get_qualifiers() -= Type::Qualifiers( Type:: Lvalue | Type::Const | Type::Volatile | Type::Restrict | Type::Atomic );99 castType->get_qualifiers() -= Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic ); 100 100 // castType->set_lvalue( true ); // xxx - might not need this 101 101 dstParam = new CastExpr( dstParam, new ReferenceType( Type::Qualifiers(), castType ) ); -
src/SymTab/ManglerCommon.cc
rc921712 rc3a2007 88 88 { Type::Atomic, "DA" }, // A is array, so need something unique for atmoic. For now, go with multiletter DA 89 89 { Type::Mutex, "X" }, 90 { Type::Lvalue, "L" },91 90 }; 92 91 -
src/SymTab/Validate.cc
rc921712 rc3a2007 81 81 #include "SynTree/Label.h" // for operator==, Label 82 82 #include "SynTree/Mutator.h" // for Mutator 83 #include "SynTree/TopLvalue.h" // for assertTopLvalue, clearInnerLvalue84 83 #include "SynTree/Type.h" // for Type, TypeInstType, EnumInstType 85 84 #include "SynTree/TypeSubstitution.h" // for TypeSubstitution … … 309 308 PassVisitor<FixQualifiedTypes> fixQual; 310 309 311 assertTopLvalue( translationUnit );312 310 { 313 311 Stats::Heap::newPass("validate-A"); … … 318 316 acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes_old because it is an indexer and needs correct types for mangling 319 317 } 320 assertTopLvalue( translationUnit );321 318 { 322 319 Stats::Heap::newPass("validate-B"); 323 320 Stats::Time::BlockGuard guard("validate-B"); 324 assertTopLvalue( translationUnit );325 321 Stats::Time::TimeBlock("Link Reference To Types", [&]() { 326 322 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions 327 323 }); 328 clearInnerLvalue( translationUnit );329 assertTopLvalue( translationUnit );330 324 Stats::Time::TimeBlock("Fix Qualified Types", [&]() { 331 325 mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes_old, because aggregate members are accessed 332 326 }); 333 assertTopLvalue( translationUnit );334 327 Stats::Time::TimeBlock("Hoist Structs", [&]() { 335 328 HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order 336 329 }); 337 assertTopLvalue( translationUnit );338 330 Stats::Time::TimeBlock("Eliminate Typedefs", [&]() { 339 331 EliminateTypedef::eliminateTypedef( translationUnit ); // 340 332 }); 341 333 } 342 assertTopLvalue( translationUnit );343 334 { 344 335 Stats::Heap::newPass("validate-C"); … … 349 340 InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen 350 341 } 351 assertTopLvalue( translationUnit );352 342 { 353 343 Stats::Heap::newPass("validate-D"); 354 344 Stats::Time::BlockGuard guard("validate-D"); 355 assertTopLvalue( translationUnit );356 345 Stats::Time::TimeBlock("Apply Concurrent Keywords", [&]() { 357 346 Concurrency::applyKeywords( translationUnit ); 358 347 }); 359 clearInnerLvalue( translationUnit );360 assertTopLvalue( translationUnit );361 348 Stats::Time::TimeBlock("Forall Pointer Decay", [&]() { 362 349 acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution 363 350 }); 364 assertTopLvalue( translationUnit );365 351 Stats::Time::TimeBlock("Hoist Control Declarations", [&]() { 366 352 ControlStruct::hoistControlDecls( translationUnit ); // hoist initialization out of for statements; must happen before autogenerateRoutines 367 353 }); 368 assertTopLvalue( translationUnit );369 354 Stats::Time::TimeBlock("Generate Autogen routines", [&]() { 370 355 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay_old 371 356 }); 372 clearInnerLvalue( translationUnit ); 373 } 374 assertTopLvalue( translationUnit ); 357 } 375 358 { 376 359 Stats::Heap::newPass("validate-E"); 377 360 Stats::Time::BlockGuard guard("validate-E"); 378 assertTopLvalue( translationUnit );379 361 Stats::Time::TimeBlock("Implement Mutex Func", [&]() { 380 362 Concurrency::implementMutexFuncs( translationUnit ); 381 363 }); 382 clearInnerLvalue( translationUnit );383 assertTopLvalue( translationUnit );384 364 Stats::Time::TimeBlock("Implement Thread Start", [&]() { 385 365 Concurrency::implementThreadStarter( translationUnit ); 386 366 }); 387 assertTopLvalue( translationUnit );388 367 Stats::Time::TimeBlock("Compound Literal", [&]() { 389 368 mutateAll( translationUnit, compoundliteral ); 390 369 }); 391 assertTopLvalue( translationUnit );392 370 Stats::Time::TimeBlock("Resolve With Expressions", [&]() { 393 371 ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables 394 372 }); 395 clearInnerLvalue( translationUnit ); 396 } 397 assertTopLvalue( translationUnit ); 373 } 398 374 { 399 375 Stats::Heap::newPass("validate-F"); 400 376 Stats::Time::BlockGuard guard("validate-F"); 401 assertTopLvalue( translationUnit );402 377 Stats::Time::TimeBlock("Fix Object Type", [&]() { 403 378 FixObjectType::fix( translationUnit ); 404 379 }); 405 assertTopLvalue( translationUnit );406 380 Stats::Time::TimeBlock("Array Length", [&]() { 407 381 ArrayLength::computeLength( translationUnit ); 408 382 }); 409 clearInnerLvalue( translationUnit );410 assertTopLvalue( translationUnit );411 383 Stats::Time::TimeBlock("Find Special Declarations", [&]() { 412 384 Validate::findSpecialDecls( translationUnit ); 413 385 }); 414 assertTopLvalue( translationUnit );415 386 Stats::Time::TimeBlock("Fix Label Address", [&]() { 416 387 mutateAll( translationUnit, labelAddrFixer ); 417 388 }); 418 assertTopLvalue( translationUnit );419 389 Stats::Time::TimeBlock("Handle Attributes", [&]() { 420 390 Validate::handleAttributes( translationUnit ); 421 391 }); 422 392 } 423 assertTopLvalue( translationUnit );424 393 } 425 394 … … 1334 1303 void FixObjectType::previsit( ObjectDecl * objDecl ) { 1335 1304 Type * new_type = ResolvExpr::resolveTypeof( objDecl->get_type(), indexer ); 1336 new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type1337 1305 objDecl->set_type( new_type ); 1338 1306 } … … 1340 1308 void FixObjectType::previsit( FunctionDecl * funcDecl ) { 1341 1309 Type * new_type = ResolvExpr::resolveTypeof( funcDecl->type, indexer ); 1342 new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type1343 1310 funcDecl->set_type( new_type ); 1344 1311 } … … 1347 1314 if ( typeDecl->get_base() ) { 1348 1315 Type * new_type = ResolvExpr::resolveTypeof( typeDecl->get_base(), indexer ); 1349 new_type->get_qualifiers() -= Type::Lvalue; // even if typeof is lvalue, variable can never have lvalue-qualified type1350 1316 typeDecl->set_base( new_type ); 1351 1317 } // if -
src/SynTree/AddressExpr.cc
rc921712 rc3a2007 53 53 } // if 54 54 } 55 // result of & is never an lvalue56 get_result()->set_lvalue( false );57 55 } 58 56 } -
src/SynTree/ApplicationExpr.cc
rc921712 rc3a2007 25 25 #include "Declaration.h" // for Declaration 26 26 #include "Expression.h" // for ParamEntry, ApplicationExpr, Expression 27 #include "InitTweak/InitTweak.h" // for getFunction 27 28 #include "ResolvExpr/typeops.h" // for extractResultType 28 29 #include "Type.h" // for Type, PointerType, FunctionType … … 77 78 78 79 bool ApplicationExpr::get_lvalue() const { 79 return result->get_lvalue(); 80 // from src/GenPoly/Lvalue.cc: isIntrinsicReference 81 static std::set<std::string> lvalueFunctions = { "*?", "?[?]" }; 82 if ( const DeclarationWithType * func = InitTweak::getFunction( this ) ) { 83 return func->linkage == LinkageSpec::Intrinsic && lvalueFunctions.count(func->name); 84 } 85 return false; 80 86 } 81 87 -
src/SynTree/ArrayType.cc
rc921712 rc3a2007 26 26 ArrayType::ArrayType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes ) 27 27 : Type( tq, attributes ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic ) { 28 base->set_lvalue( false );29 28 } 30 29 -
src/SynTree/CommaExpr.cc
rc921712 rc3a2007 23 23 CommaExpr::CommaExpr( Expression *arg1, Expression *arg2 ) 24 24 : Expression(), arg1( arg1 ), arg2( arg2 ) { 25 // xxx - result of a comma expression is never an lvalue, so should set lvalue26 // to false on all result types. Actually doing this causes some strange things27 // to happen in later passes (particularly, Specialize, Lvalue, and Box). This needs to be looked into.28 25 set_result( maybeClone( arg2->get_result() ) ); 29 // get_type->set_isLvalue( false );30 26 } 31 27 … … 40 36 41 37 bool CommaExpr::get_lvalue() const { 42 // xxx - as above, shouldn't be an lvalue but that information is used anyways. 43 return result->get_lvalue(); 38 // This is wrong by C, but the current implementation uses it. 39 // (ex: Specialize, Lvalue and Box) 40 return arg2->get_lvalue(); 44 41 } 45 42 -
src/SynTree/Expression.cc
rc921712 rc3a2007 19 19 #include <iostream> // for ostream, operator<<, basic_ostream 20 20 #include <list> // for list, _List_iterator, list<>::co... 21 #include <set> // for set 21 22 22 23 #include "Common/utility.h" // for maybeClone, cloneAll, deleteAll … … 64 65 65 66 bool Expression::get_lvalue() const { 66 assert( !result->get_lvalue() );67 67 return false; 68 68 } … … 115 115 assert( var->get_type() ); 116 116 Type * type = var->get_type()->clone(); 117 type->set_lvalue( true );118 117 119 118 // xxx - doesn't quite work yet - get different alternatives with the same cost … … 125 124 // long long int value; 126 125 // if ( decl->valueOf( var, value ) ) { 127 // type->set_lvalue( false ); 126 // type->set_lvalue( false ); // Would have to move to get_lvalue. 128 127 // } 129 128 // } … … 140 139 141 140 bool VariableExpr::get_lvalue() const { 142 return result->get_lvalue(); 141 // It isn't always an lvalue, but it is never an rvalue. 142 return true; 143 143 } 144 144 … … 277 277 278 278 bool CastExpr::get_lvalue() const { 279 return result->get_lvalue(); 279 // This is actually wrong by C, but it works with our current set-up. 280 return arg->get_lvalue(); 280 281 } 281 282 … … 360 361 } 361 362 363 bool UntypedMemberExpr::get_lvalue() const { 364 return aggregate->get_lvalue(); 365 } 366 362 367 void UntypedMemberExpr::print( std::ostream & os, Indenter indent ) const { 363 368 os << "Untyped Member Expression, with field: " << std::endl << indent+1; … … 378 383 sub.apply( res ); 379 384 result = res; 380 result->set_lvalue( true );381 385 result->get_qualifiers() |= aggregate->result->get_qualifiers(); 382 386 } … … 392 396 393 397 bool MemberExpr::get_lvalue() const { 394 assert( result->get_lvalue() );398 // This is actually wrong by C, but it works with our current set-up. 395 399 return true; 396 400 } … … 427 431 // if references are still allowed in the AST, dereference returns a reference 428 432 ret->set_result( new ReferenceType( Type::Qualifiers(), ret->get_result() ) ); 429 } else {430 // references have been removed, in which case dereference returns an lvalue of the base type.431 ret->result->set_lvalue( true );432 433 } 433 434 } … … 447 448 448 449 bool UntypedExpr::get_lvalue() const { 449 return result->get_lvalue(); 450 // from src/GenPoly/Lvalue.cc: isIntrinsicReference 451 static std::set<std::string> lvalueFunctions = { "*?", "?[?]" }; 452 std::string fname = InitTweak::getFunctionName( const_cast< UntypedExpr * >( this ) ); 453 return lvalueFunctions.count(fname); 450 454 } 451 455 … … 510 514 511 515 bool ConditionalExpr::get_lvalue() const { 512 return result->get_lvalue();516 return false; 513 517 } 514 518 … … 570 574 571 575 bool ConstructorExpr::get_lvalue() const { 572 return result->get_lvalue();576 return false; 573 577 } 574 578 … … 582 586 CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : initializer( initializer ) { 583 587 assert( type && initializer ); 584 type->set_lvalue( true );585 588 set_result( type ); 586 589 } … … 593 596 594 597 bool CompoundLiteralExpr::get_lvalue() const { 595 assert( result->get_lvalue() );596 598 return true; 597 599 } … … 648 650 } 649 651 bool StmtExpr::get_lvalue() const { 650 return result->get_lvalue();652 return false; 651 653 } 652 654 void StmtExpr::print( std::ostream & os, Indenter indent ) const { -
src/SynTree/Expression.h
rc921712 rc3a2007 275 275 virtual ~UntypedMemberExpr(); 276 276 277 bool get_lvalue() const final; 278 277 279 Expression * get_member() const { return member; } 278 280 void set_member( Expression * newValue ) { member = newValue; } -
src/SynTree/TupleExpr.cc
rc921712 rc3a2007 58 58 59 59 bool TupleExpr::get_lvalue() const { 60 return result->get_lvalue();60 return false; 61 61 } 62 62 … … 71 71 assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested index %d in expr %s", type->size(), index, toString( tuple ).c_str() ); 72 72 set_result( (*std::next( type->get_types().begin(), index ))->clone() ); 73 // like MemberExpr, TupleIndexExpr is always an lvalue74 get_result()->set_lvalue( true );75 73 } 76 74 … … 83 81 84 82 bool TupleIndexExpr::get_lvalue() const { 85 assert( result->get_lvalue() ); 86 return true; 83 return tuple->get_lvalue(); 87 84 } 88 85 -
src/SynTree/Type.cc
rc921712 rc3a2007 85 85 const char * Type::FuncSpecifiersNames[] = { "inline", "_Noreturn", "fortran" }; 86 86 const char * Type::StorageClassesNames[] = { "extern", "static", "auto", "register", "_Thread_local" }; 87 const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", " lvalue", "mutex", "_Atomic" };87 const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", "mutex", "_Atomic" }; 88 88 89 89 Type * Type::stripDeclarator() { -
src/SynTree/Type.h
rc921712 rc3a2007 102 102 }; // StorageClasses 103 103 104 enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Lvalue = 1 << 3, Mutex = 1 << 4, Atomic = 1 << 5, NumTypeQualifier = 6};104 enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Mutex = 1 << 3, Atomic = 1 << 4, NumTypeQualifier = 5 }; 105 105 static const char * QualifiersNames[]; 106 106 union Qualifiers { 107 enum { Mask = ~ (Restrict | Lvalue)};107 enum { Mask = ~Restrict }; 108 108 unsigned int val; 109 109 struct { … … 111 111 bool is_restrict : 1; 112 112 bool is_volatile : 1; 113 bool is_lvalue : 1;114 113 bool is_mutex : 1; 115 114 bool is_atomic : 1; … … 153 152 bool get_volatile() const { return tq.is_volatile; } 154 153 bool get_restrict() const { return tq.is_restrict; } 155 bool get_lvalue() const { return tq.is_lvalue; }156 154 bool get_mutex() const { return tq.is_mutex; } 157 155 bool get_atomic() const { return tq.is_atomic; } … … 159 157 void set_volatile( bool newValue ) { tq.is_volatile = newValue; } 160 158 void set_restrict( bool newValue ) { tq.is_restrict = newValue; } 161 void set_lvalue( bool newValue ) { tq.is_lvalue = newValue; }162 159 void set_mutex( bool newValue ) { tq.is_mutex = newValue; } 163 160 void set_atomic( bool newValue ) { tq.is_atomic = newValue; } -
src/SynTree/module.mk
rc921712 rc3a2007 49 49 SynTree/TypeSubstitution.cc \ 50 50 SynTree/Attribute.cc \ 51 SynTree/DeclReplacer.cc \ 52 SynTree/TopLvalue.cc 51 SynTree/DeclReplacer.cc 53 52 54 53 SRC += $(SRC_SYNTREE) -
src/Tuples/TupleExpansion.cc
rc921712 rc3a2007 304 304 // produce the TupleType which aggregates the types of the exprs 305 305 std::list< Type * > types; 306 Type::Qualifiers qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type:: Lvalue | Type::Atomic | Type::Mutex );306 Type::Qualifiers qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic | Type::Mutex ); 307 307 for ( Expression * expr : exprs ) { 308 308 assert( expr->get_result() ); -
src/main.cc
rc921712 rc3a2007 59 59 #include "ResolvExpr/Resolver.h" // for resolve 60 60 #include "SymTab/Validate.h" // for validate 61 #include "SynTree/TopLvalue.h" // for assertTopLvalue, clearInn...62 61 #include "SynTree/Declaration.h" // for Declaration 63 62 #include "SynTree/Visitor.h" // for acceptAll … … 259 258 Stats::Time::StopBlock(); 260 259 261 //std::cerr << "Post-Parse Check" << std::endl;262 clearInnerLvalue( translationUnit );263 assertTopLvalue( translationUnit );264 265 260 // add the assignment statement after the initialization of a type parameter 266 261 PASS( "Validate", SymTab::validate( translationUnit, symtabp ) ); … … 281 276 } // if 282 277 283 assertTopLvalue( translationUnit );284 278 PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) ); 285 assertTopLvalue( translationUnit );286 279 PASS( "Fix Names", CodeGen::fixNames( translationUnit ) ); 287 assertTopLvalue( translationUnit );288 280 PASS( "Gen Init", InitTweak::genInit( translationUnit ) ); 289 assertTopLvalue( translationUnit );290 281 PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) ); 291 assertTopLvalue( translationUnit );292 282 if ( libcfap ) { 293 283 // generate the bodies of cfa library functions … … 313 303 } // if 314 304 315 assertTopLvalue( translationUnit );316 317 305 PASS( "Resolve", ResolvExpr::resolve( translationUnit ) ); 318 306 if ( exprp ) { … … 321 309 } // if 322 310 323 clearInnerLvalue( translationUnit );324 assertTopLvalue( translationUnit );325 326 311 // fix ObjectDecl - replaces ConstructorInit nodes 327 312 PASS( "Fix Init", InitTweak::fix( translationUnit, buildingLibrary() ) ); 328 clearInnerLvalue( translationUnit );329 assertTopLvalue( translationUnit );330 313 if ( ctorinitp ) { 331 314 dump ( translationUnit ); … … 334 317 335 318 PASS( "Expand Unique Expr", Tuples::expandUniqueExpr( translationUnit ) ); // xxx - is this the right place for this? want to expand ASAP so tha, sequent passes don't need to worry about double-visiting a unique expr - needs to go after InitTweak::fix so that copy constructed return declarations are reused 336 assertTopLvalue( translationUnit );337 319 338 320 PASS( "Translate EHM" , ControlStruct::translateEHM( translationUnit ) ); 339 assertTopLvalue( translationUnit );340 321 341 322 PASS( "Gen Waitfor" , Concurrency::generateWaitFor( translationUnit ) ); 342 clearInnerLvalue( translationUnit );343 assertTopLvalue( translationUnit );344 323 345 324 PASS( "Convert Specializations", GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded 346 clearInnerLvalue( translationUnit );347 assertTopLvalue( translationUnit );348 325 349 326 PASS( "Expand Tuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this? 350 assertTopLvalue( translationUnit );351 327 352 328 if ( tuplep ) { … … 356 332 357 333 PASS( "Virtual Expand Casts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM 358 assertTopLvalue( translationUnit );359 334 360 335 PASS( "Instantiate Generics", GenPoly::instantiateGeneric( translationUnit ) ); … … 363 338 return EXIT_SUCCESS; 364 339 } // if 365 clearInnerLvalue( translationUnit ); 366 assertTopLvalue( translationUnit ); 340 367 341 PASS( "Convert L-Value", GenPoly::convertLvalue( translationUnit ) ); 368 clearInnerLvalue( translationUnit );369 assertTopLvalue( translationUnit );370 342 371 343 if ( bboxp ) { … … 374 346 } // if 375 347 PASS( "Box", GenPoly::box( translationUnit ) ); 376 clearInnerLvalue( translationUnit );377 assertTopLvalue( translationUnit );378 348 379 349 if ( bcodegenp ) { … … 387 357 388 358 CodeTools::fillLocations( translationUnit ); 389 assertTopLvalue( translationUnit );390 359 PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! genproto, prettycodegenp, true, linemarks ) ); 391 360
Note: See TracChangeset
for help on using the changeset viewer.