Changeset f57dd25 for src/SymTab/Validate.cc
- Timestamp:
- May 29, 2019, 3:45:00 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:
- 0aedb01
- Parents:
- 157a816 (diff), ebc0a85 (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
r157a816 rf57dd25 76 76 #include "SynTree/Visitor.h" // for Visitor 77 77 #include "Validate/HandleAttributes.h" // for handleAttributes 78 #include "Validate/FindSpecialDecls.h" // for FindSpecialDecls 78 79 79 80 class CompoundStmt; … … 288 289 }; 289 290 290 FunctionDecl * dereferenceOperator = nullptr;291 struct FindSpecialDeclarations final {292 void previsit( FunctionDecl * funcDecl );293 };294 295 291 void validate( std::list< Declaration * > &translationUnit, __attribute__((unused)) bool doDebug ) { 296 292 PassVisitor<EnumAndPointerDecay> epc; … … 299 295 PassVisitor<CompoundLiteral> compoundliteral; 300 296 PassVisitor<ValidateGenericParameters> genericParams; 301 PassVisitor<FindSpecialDeclarations> finder;302 297 PassVisitor<LabelAddressFixer> labelAddrFixer; 303 298 PassVisitor<HoistTypeDecls> hoistDecls; … … 378 373 }); 379 374 Stats::Time::TimeBlock("Find Special Declarations", [&]() { 380 acceptAll( translationUnit, finder ); // xxx - remove this pass soon375 Validate::findSpecialDecls( translationUnit ); 381 376 }); 382 377 Stats::Time::TimeBlock("Fix Label Address", [&]() { … … 943 938 if ( eliminator.pass.typedefNames.count( "size_t" ) ) { 944 939 // grab and remember declaration of size_t 945 SizeType = eliminator.pass.typedefNames["size_t"].first->base->clone();940 Validate::SizeType = eliminator.pass.typedefNames["size_t"].first->base->clone(); 946 941 } else { 947 942 // xxx - missing global typedef for size_t - default to long unsigned int, even though that may be wrong 948 943 // eventually should have a warning for this case. 949 SizeType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );944 Validate::SizeType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ); 950 945 } 951 946 } … … 1335 1330 // need to resolve array dimensions early so that constructor code can correctly determine 1336 1331 // if a type is a VLA (and hence whether its elements need to be constructed) 1337 ResolvExpr::findSingleExpression( type->dimension, SymTab::SizeType->clone(), indexer );1332 ResolvExpr::findSingleExpression( type->dimension, Validate::SizeType->clone(), indexer ); 1338 1333 1339 1334 // must re-evaluate whether a type is a VLA, now that more information is available … … 1372 1367 return addrExpr; 1373 1368 } 1374 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 }1384 }1385 1369 } // namespace SymTab 1386 1370
Note: See TracChangeset
for help on using the changeset viewer.