Changes in src/SymTab/Validate.cc [c8e4d2f8:0d70e0d]
- File:
-
- 1 edited
-
src/SymTab/Validate.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Validate.cc
rc8e4d2f8 r0d70e0d 76 76 #include "SynTree/Visitor.h" // for Visitor 77 77 #include "Validate/HandleAttributes.h" // for handleAttributes 78 #include "Validate/FindSpecialDecls.h" // for FindSpecialDecls79 78 80 79 class CompoundStmt; … … 289 288 }; 290 289 290 FunctionDecl * dereferenceOperator = nullptr; 291 struct FindSpecialDeclarations final { 292 void previsit( FunctionDecl * funcDecl ); 293 }; 294 291 295 void validate( std::list< Declaration * > &translationUnit, __attribute__((unused)) bool doDebug ) { 292 296 PassVisitor<EnumAndPointerDecay> epc; … … 295 299 PassVisitor<CompoundLiteral> compoundliteral; 296 300 PassVisitor<ValidateGenericParameters> genericParams; 301 PassVisitor<FindSpecialDeclarations> finder; 297 302 PassVisitor<LabelAddressFixer> labelAddrFixer; 298 303 PassVisitor<HoistTypeDecls> hoistDecls; … … 373 378 }); 374 379 Stats::Time::TimeBlock("Find Special Declarations", [&]() { 375 Validate::findSpecialDecls( translationUnit );380 acceptAll( translationUnit, finder ); // xxx - remove this pass soon 376 381 }); 377 382 Stats::Time::TimeBlock("Fix Label Address", [&]() { … … 938 943 if ( eliminator.pass.typedefNames.count( "size_t" ) ) { 939 944 // grab and remember declaration of size_t 940 Validate::SizeType = eliminator.pass.typedefNames["size_t"].first->base->clone();945 SizeType = eliminator.pass.typedefNames["size_t"].first->base->clone(); 941 946 } else { 942 947 // xxx - missing global typedef for size_t - default to long unsigned int, even though that may be wrong 943 948 // eventually should have a warning for this case. 944 Validate::SizeType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );949 SizeType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ); 945 950 } 946 951 } … … 1330 1335 // need to resolve array dimensions early so that constructor code can correctly determine 1331 1336 // if a type is a VLA (and hence whether its elements need to be constructed) 1332 ResolvExpr::findSingleExpression( type->dimension, Validate::SizeType->clone(), indexer );1337 ResolvExpr::findSingleExpression( type->dimension, SymTab::SizeType->clone(), indexer ); 1333 1338 1334 1339 // must re-evaluate whether a type is a VLA, now that more information is available … … 1368 1373 } 1369 1374 1370 const ast::Type * validateType( const ast::Type * type, const ast::SymbolTable & symtab ) { 1371 #warning unimplemented 1372 (void)type; (void)symtab; 1373 assert(false); 1374 return nullptr; 1375 void FindSpecialDeclarations::previsit( FunctionDecl * funcDecl ) { 1376 if ( ! dereferenceOperator ) { 1377 if ( funcDecl->get_name() == "*?" && funcDecl->get_linkage() == LinkageSpec::Intrinsic ) { 1378 FunctionType * ftype = funcDecl->get_functionType(); 1379 if ( ftype->get_parameters().size() == 1 && ftype->get_parameters().front()->get_type()->get_qualifiers() == Type::Qualifiers() ) { 1380 dereferenceOperator = funcDecl; 1381 } 1382 } 1383 } 1375 1384 } 1376 1385 } // namespace SymTab
Note:
See TracChangeset
for help on using the changeset viewer.