Mercurial > projects > ddmd
diff dmd/IRState.d @ 130:60bb0fe4563e
dmdfe 2.037 first main iteration
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Thu, 09 Sep 2010 22:51:44 +0100 |
parents | e28b18c23469 |
children | e3afd1303184 |
line wrap: on
line diff
--- a/dmd/IRState.d Sun Sep 05 15:32:22 2010 +0400 +++ b/dmd/IRState.d Thu Sep 09 22:51:44 2010 +0100 @@ -9,6 +9,10 @@ import dmd.FuncDeclaration; import dmd.Global; import dmd.Loc; +import dmd.TRUST; +import dmd.TY; +import dmd.TypeFunction; +import dmd.Type; import dmd.backend.Symbol; import dmd.backend.Blockx; @@ -124,6 +128,28 @@ } return cast(FuncDeclaration)(bc.symbol); } + + /********************** + * Return !=0 if do array bounds checking + */ + int arrayBoundsCheck() + { + int result = global.params.useArrayBounds; + + if (result == 1) + { + // For safe functions only + result = 0; + FuncDeclaration fd = getFunc(); + if (fd) + { + Type t = fd.type; + if (t.ty == TY.Tfunction && (cast(TypeFunction)t).trust == TRUST.TRUSTsafe) + result = 1; + } + } + return result; + } } /*********************************************