Changeset 2bfc6b2 for src/SymTab
- Timestamp:
- Aug 30, 2018, 1:00:41 PM (7 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- bcc0946
- Parents:
- a715b5c
- Location:
- src/SymTab
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/SymTab/Autogen.cc ¶
ra715b5c r2bfc6b2 41 41 42 42 namespace SymTab { 43 Type * SizeType = 0;44 45 43 /// Data used to generate functions generically. Specifically, the name of the generated function and a function which generates the routine protoype 46 44 struct FuncData { -
TabularUnified src/SymTab/Autogen.h ¶
ra715b5c r2bfc6b2 36 36 /// returns true if obj's name is the empty string and it has a bitfield width 37 37 bool isUnnamedBitfield( ObjectDecl * obj ); 38 39 /// size_t type - set when size_t typedef is seen. Useful in a few places,40 /// such as in determining array dimension type41 extern Type * SizeType;42 43 /// intrinsic dereference operator for unqualified types - set when *? function is seen in FindSpecialDeclarations.44 /// Useful for creating dereference ApplicationExprs without a full resolver pass.45 extern FunctionDecl * dereferenceOperator;46 38 47 39 /// generate the type of an assignment function for paramType. -
TabularUnified src/SymTab/Validate.cc ¶
ra715b5c r2bfc6b2 75 75 #include "SynTree/Visitor.h" // for Visitor 76 76 #include "Validate/HandleAttributes.h" // for handleAttributes 77 #include "Validate/FindSpecialDecls.h" // for FindSpecialDecls 77 78 78 79 class CompoundStmt; … … 287 288 }; 288 289 289 FunctionDecl * dereferenceOperator = nullptr;290 struct FindSpecialDeclarations final {291 void previsit( FunctionDecl * funcDecl );292 };293 294 290 void validate( std::list< Declaration * > &translationUnit, __attribute__((unused)) bool doDebug ) { 295 291 PassVisitor<EnumAndPointerDecay> epc; … … 298 294 PassVisitor<CompoundLiteral> compoundliteral; 299 295 PassVisitor<ValidateGenericParameters> genericParams; 300 PassVisitor<FindSpecialDeclarations> finder;301 296 PassVisitor<LabelAddressFixer> labelAddrFixer; 302 297 PassVisitor<HoistTypeDecls> hoistDecls; … … 325 320 FixObjectType::fix( translationUnit ); 326 321 ArrayLength::computeLength( translationUnit ); 327 acceptAll( translationUnit, finder ); // xxx - remove this pass soon322 Validate::findSpecialDecls( translationUnit ); 328 323 mutateAll( translationUnit, labelAddrFixer ); 329 324 Validate::handleAttributes( translationUnit ); … … 901 896 if ( eliminator.pass.typedefNames.count( "size_t" ) ) { 902 897 // grab and remember declaration of size_t 903 SizeType = eliminator.pass.typedefNames["size_t"].first->base->clone();898 Validate::SizeType = eliminator.pass.typedefNames["size_t"].first->base->clone(); 904 899 } else { 905 900 // xxx - missing global typedef for size_t - default to long unsigned int, even though that may be wrong 906 901 // eventually should have a warning for this case. 907 SizeType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );902 Validate::SizeType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ); 908 903 } 909 904 } … … 1293 1288 // need to resolve array dimensions early so that constructor code can correctly determine 1294 1289 // if a type is a VLA (and hence whether its elements need to be constructed) 1295 ResolvExpr::findSingleExpression( type->dimension, SymTab::SizeType->clone(), indexer );1290 ResolvExpr::findSingleExpression( type->dimension, Validate::SizeType->clone(), indexer ); 1296 1291 1297 1292 // must re-evaluate whether a type is a VLA, now that more information is available … … 1330 1325 return addrExpr; 1331 1326 } 1332 1333 void FindSpecialDeclarations::previsit( FunctionDecl * funcDecl ) {1334 if ( ! dereferenceOperator ) {1335 // find and remember the intrinsic dereference operator for object pointers1336 if ( funcDecl->name == "*?" && funcDecl->linkage == LinkageSpec::Intrinsic ) {1337 FunctionType * ftype = funcDecl->type;1338 if ( ftype->parameters.size() == 1 ) {1339 PointerType * ptrType = strict_dynamic_cast<PointerType *>( ftype->parameters.front()->get_type() );1340 if ( ptrType->base->get_qualifiers() == Type::Qualifiers() ) {1341 TypeInstType * inst = dynamic_cast<TypeInstType *>( ptrType->base );1342 if ( inst && ! inst->get_isFtype() ) {1343 dereferenceOperator = funcDecl;1344 }1345 }1346 }1347 }1348 }1349 }1350 1327 } // namespace SymTab 1351 1328
Note: See TracChangeset
for help on using the changeset viewer.