Skip to content

Commit

Permalink
sl/symproc.cc: minor code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
kdudka committed Oct 30, 2015
1 parent 2cd0d6e commit e3afd01
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions sl/symproc.cc
Expand Up @@ -635,7 +635,7 @@ enum EPointerKind {
TValId ptrObjectEncoderCore(
SymProc &proc,
const FldHandle &dst,
const TValId val,
TValId val,
const EPointerKind code)
{
SymHeap &sh = proc.sh();
Expand All @@ -653,16 +653,17 @@ TValId ptrObjectEncoderCore(
break;
}

const struct cl_loc *loc = proc.lw();
const TSizeOf dstSize = dst.type()->size;
if (ptrSize <= dstSize)
return val;
if (dstSize < ptrSize) {
CL_ERROR_MSG(loc, "not enough space to store value of a pointer");
CL_NOTE_MSG(loc, "dstSize: " << dstSize << " B");
CL_NOTE_MSG(loc, "ptrSize: " << ptrSize << " B");
proc.printBackTrace(ML_ERROR);
return sh.valCreate(VT_UNKNOWN, VO_REINTERPRET);
}

const struct cl_loc *loc = proc.lw();
CL_ERROR_MSG(loc, "not enough space to store value of a pointer");
CL_NOTE_MSG(loc, "dstSize: " << dstSize << " B");
CL_NOTE_MSG(loc, "ptrSize: " << ptrSize << " B");
proc.printBackTrace(ML_ERROR);
return sh.valCreate(VT_UNKNOWN, VO_REINTERPRET);
return val;
}

TValId ptrObjectEncoder(SymProc &proc, const FldHandle &dst, TValId val)
Expand Down

0 comments on commit e3afd01

Please sign in to comment.