Skip to content

Commit

Permalink
refactor arrayBoundsCheck()
Browse files Browse the repository at this point in the history
  • Loading branch information
0-v-0 authored and dlang-bot committed Jul 3, 2024
1 parent 7c416b9 commit 92b4348
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions compiler/src/dmd/toir.d
Original file line number Diff line number Diff line change
Expand Up @@ -119,31 +119,25 @@ struct IRState
{
if (m.filetype == FileType.c)
return false;
bool result;
final switch (params.useArrayBounds)
{
case CHECKENABLE.off:
result = false;
break;
return false;
case CHECKENABLE.on:
result = true;
break;
return true;
case CHECKENABLE.safeonly:
{
result = false;
FuncDeclaration fd = getFunc();
if (fd)
if (FuncDeclaration fd = getFunc())
{
Type t = fd.type;
if (t.ty == Tfunction && (cast(TypeFunction)t).trust == TRUST.safe)
result = true;
return true;
}
break;
return false;
}
case CHECKENABLE._default:
assert(0);
}
return result;
}

/****************************
Expand Down

0 comments on commit 92b4348

Please sign in to comment.