Changeset 2e9b59b for src/SymTab/Validate.cc
- Timestamp:
- Apr 19, 2022, 3:00:04 PM (3 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 5b84a321
- Parents:
- ba897d21 (diff), bb7c77d (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Validate.cc
rba897d21 r2e9b59b 395 395 TranslateDimensionGenericParameters::translateDimensions( translationUnit ); 396 396 }); 397 if (!useNewAST) { 397 398 Stats::Time::TimeBlock("Resolve Enum Initializers", [&]() { 398 399 acceptAll( translationUnit, rei ); // must happen after translateDimensions because rei needs identifier lookup, which needs name mangling 399 400 }); 401 } 400 402 Stats::Time::TimeBlock("Check Function Returns", [&]() { 401 403 ReturnChecker::checkFunctionReturns( translationUnit ); … … 405 407 }); 406 408 } 409 } 410 411 static void decayForallPointers( std::list< Declaration * > & translationUnit ) { 412 PassVisitor<TraitExpander_old> te; 413 acceptAll( translationUnit, te ); 414 PassVisitor<AssertionFixer_old> af; 415 acceptAll( translationUnit, af ); 416 PassVisitor<CheckOperatorTypes_old> cot; 417 acceptAll( translationUnit, cot ); 418 PassVisitor<FixUniqueIds_old> fui; 419 acceptAll( translationUnit, fui ); 407 420 } 408 421 … … 474 487 } 475 488 476 void decayForallPointers( std::list< Declaration * > & translationUnit ) {477 PassVisitor<TraitExpander_old> te;478 acceptAll( translationUnit, te );479 PassVisitor<AssertionFixer_old> af;480 acceptAll( translationUnit, af );481 PassVisitor<CheckOperatorTypes_old> cot;482 acceptAll( translationUnit, cot );483 PassVisitor<FixUniqueIds_old> fui;484 acceptAll( translationUnit, fui );485 }486 487 void decayForallPointersA( std::list< Declaration * > & translationUnit ) {488 PassVisitor<TraitExpander_old> te;489 acceptAll( translationUnit, te );490 }491 void decayForallPointersB( std::list< Declaration * > & translationUnit ) {492 PassVisitor<AssertionFixer_old> af;493 acceptAll( translationUnit, af );494 }495 void decayForallPointersC( std::list< Declaration * > & translationUnit ) {496 PassVisitor<CheckOperatorTypes_old> cot;497 acceptAll( translationUnit, cot );498 }499 void decayForallPointersD( std::list< Declaration * > & translationUnit ) {500 PassVisitor<FixUniqueIds_old> fui;501 acceptAll( translationUnit, fui );502 }503 504 489 void validate( std::list< Declaration * > &translationUnit, __attribute__((unused)) bool doDebug ) { 505 490 validate_A( translationUnit ); … … 989 974 // need to resolve enumerator initializers early so that other passes that determine if an expression is constexpr have the appropriate information. 990 975 SingleInit * init = strict_dynamic_cast<SingleInit *>( field->init ); 991 ResolvExpr::findSingleExpression( init->value, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), indexer ); 976 if ( !enumDecl->base || dynamic_cast<BasicType *>(enumDecl->base)) 977 ResolvExpr::findSingleExpression( init->value, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), indexer ); 978 else { 979 if (dynamic_cast<PointerType *>(enumDecl->base)) { 980 auto typePtr = dynamic_cast<PointerType *>(enumDecl->base); 981 ResolvExpr::findSingleExpression( init->value, 982 new PointerType( Type::Qualifiers(), typePtr->base ), indexer ); 983 } else { 984 ResolvExpr::findSingleExpression( init->value, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), indexer ); 985 } 986 } 987 992 988 } 993 989 } 990 994 991 } // if 995 992 } … … 1255 1252 declsToAddBefore.push_back( new UnionDecl( aggDecl->name, noAttributes, tyDecl->linkage ) ); 1256 1253 } else if ( EnumInstType * enumDecl = dynamic_cast< EnumInstType * >( designatorType ) ) { 1257 declsToAddBefore.push_back( new EnumDecl( enumDecl->name, noAttributes, tyDecl->linkage ) ); 1254 // declsToAddBefore.push_back( new EnumDecl( enumDecl->name, noAttributes, tyDecl->linkage, enumDecl->baseEnum->base ) ); 1255 if (enumDecl->baseEnum) { 1256 declsToAddBefore.push_back( new EnumDecl( enumDecl->name, noAttributes, tyDecl->linkage, enumDecl->baseEnum->base ) ); 1257 } else { 1258 declsToAddBefore.push_back( new EnumDecl( enumDecl->name, noAttributes, tyDecl->linkage ) ); 1259 } 1258 1260 } // if 1259 1261 return tyDecl->clone();
Note:
See TracChangeset
for help on using the changeset viewer.