Changeset dcbb03b for src/InitTweak
- Timestamp:
- Mar 1, 2018, 9:29:03 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 1f37ed02
- Parents:
- b002261 (diff), 446ffa3 (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/InitTweak
- Files:
-
- 4 edited
-
FixGlobalInit.cc (modified) (1 diff)
-
FixInit.cc (modified) (6 diffs)
-
GenInit.cc (modified) (1 diff)
-
InitTweak.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixGlobalInit.cc
rb002261 rdcbb03b 21 21 22 22 #include "Common/PassVisitor.h" 23 #include "Common/SemanticError.h" // for SemanticError24 23 #include "Common/UniqueName.h" // for UniqueName 25 24 #include "InitTweak.h" // for isIntrinsicSingleArgCallStmt -
src/InitTweak/FixInit.cc
rb002261 rdcbb03b 213 213 Expression * postmutate( UntypedExpr * expr ); 214 214 215 SemanticError errors;215 SemanticErrorException errors; 216 216 private: 217 217 template< typename... Params > … … 276 276 // can't use mutateAll, because need to insert declarations at top-level 277 277 // can't use DeclMutator, because sometimes need to insert IfStmt, etc. 278 SemanticError errors;278 SemanticErrorException errors; 279 279 for ( std::list< Declaration * >::iterator i = translationUnit.begin(); i != translationUnit.end(); ++i ) { 280 280 try { 281 281 maybeMutate( *i, fixer ); 282 282 translationUnit.splice( i, fixer.pass.staticDtorDecls ); 283 } catch( SemanticError &e ) {283 } catch( SemanticErrorException &e ) { 284 284 errors.append( e ); 285 285 } // try … … 894 894 ) 895 895 if ( ! diff.empty() ) { 896 throwSemanticError( stmt, std::string("jump to label '") + stmt->get_target().get_name() + "' crosses initialization of " + (*diff.begin())->get_name() + " " );896 SemanticError( stmt, std::string("jump to label '") + stmt->get_target().get_name() + "' crosses initialization of " + (*diff.begin())->get_name() + " " ); 897 897 } // if 898 898 // S_G-S_L results in set of objects that must be destructed … … 945 945 GuardValue( isCtor ); 946 946 GuardValue( structDecl ); 947 errors = SemanticError (); // clear previous errors947 errors = SemanticErrorException(); // clear previous errors 948 948 949 949 // need to start with fresh sets … … 1034 1034 function->get_statements()->push_back( callStmt ); 1035 1035 } 1036 } catch ( SemanticError & error ) {1036 } catch ( SemanticErrorException & error ) { 1037 1037 emit( funcDecl->location, "in ", CodeGen::genPrettyType( function->get_functionType(), function->get_name() ), ", field ", field->get_name(), " not explicitly ", isCtor ? "constructed" : "destructed", " and no ", isCtor ? "default constructor" : "destructor", " found" ); 1038 1038 } … … 1110 1110 template< typename Visitor, typename... Params > 1111 1111 void error( Visitor & v, CodeLocation loc, const Params &... params ) { 1112 SemanticError err( loc, toString( params... ) );1112 SemanticErrorException err( loc, toString( params... ) ); 1113 1113 v.errors.append( err ); 1114 1114 } -
src/InitTweak/GenInit.cc
rb002261 rdcbb03b 317 317 if ( tryConstruct( objDecl ) && ( managedTypes.isManaged( objDecl ) || ((! inFunction || objDecl->get_storageClasses().is_static ) && ! isConstExpr( objDecl->get_init() ) ) ) ) { 318 318 // constructed objects cannot be designated 319 if ( isDesignated( objDecl->get_init() ) ) throwSemanticError( objDecl, "Cannot include designations in the initializer for a managed Object. If this is really what you want, then initialize with @=.\n" );319 if ( isDesignated( objDecl->get_init() ) ) SemanticError( objDecl, "Cannot include designations in the initializer for a managed Object. If this is really what you want, then initialize with @=.\n" ); 320 320 // constructed objects should not have initializers nested too deeply 321 if ( ! checkInitDepth( objDecl ) ) throwSemanticError( objDecl, "Managed object's initializer is too deep " );321 if ( ! checkInitDepth( objDecl ) ) SemanticError( objDecl, "Managed object's initializer is too deep " ); 322 322 323 323 objDecl->set_init( genCtorInit( objDecl ) ); -
src/InitTweak/InitTweak.cc
rb002261 rdcbb03b 225 225 // xxx - this shouldn't be an error, but need a way to 226 226 // terminate without creating output, so should catch this error 227 throwSemanticError( init->location, "unbalanced list initializers" );227 SemanticError( init->location, "unbalanced list initializers" ); 228 228 } 229 229 … … 296 296 ObjectDecl * objDecl = dynamic_cast< ObjectDecl * >( dwt ); 297 297 if ( ! objDecl ) return false; 298 return ! LinkageSpec::isBuiltin( objDecl->get_linkage() ) && 299 (objDecl->get_init() == nullptr || 298 return (objDecl->get_init() == nullptr || 300 299 ( objDecl->get_init() != nullptr && objDecl->get_init()->get_maybeConstructed() )) 301 300 && ! objDecl->get_storageClasses().is_extern
Note:
See TracChangeset
for help on using the changeset viewer.