File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -279,9 +279,10 @@ static bool fillRanges(MemoryBuffer *Code,
279
279
280
280
if (Offsets.empty ())
281
281
Offsets.push_back (0 );
282
- if (Offsets.size () == 1 && Lengths.empty ()) {
283
- Lengths.push_back (Sources.getFileOffset (Sources.getLocForEndOfFile (ID)) -
284
- Offsets[0 ]);
282
+ const bool EmptyLengths = Lengths.empty ();
283
+ unsigned Length = 0 ;
284
+ if (Offsets.size () == 1 && EmptyLengths) {
285
+ Length = Sources.getFileOffset (Sources.getLocForEndOfFile (ID)) - Offsets[0 ];
285
286
} else if (Offsets.size () != Lengths.size ()) {
286
287
errs () << " error: number of -offset and -length arguments must match.\n " ;
287
288
return true ;
@@ -292,7 +293,8 @@ static bool fillRanges(MemoryBuffer *Code,
292
293
errs () << " error: offset " << Offset << " is outside the file\n " ;
293
294
return true ;
294
295
}
295
- const auto Length = Lengths[I];
296
+ if (!EmptyLengths)
297
+ Length = Lengths[I];
296
298
if (Offset + Length > Code->getBufferSize ()) {
297
299
errs () << " error: invalid length " << Length << " , offset + length ("
298
300
<< Offset + Length << " ) is outside the file.\n " ;
You can’t perform that action at this time.
0 commit comments