Skip to content

Commit 90e4eb8

Browse files
committed
[clang][Interp][NFC] Add more source ranges to diagnostics
1 parent 5b4000d commit 90e4eb8

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

clang/lib/AST/Interp/Interp.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,9 @@ bool CheckNull(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
341341
if (!Ptr.isZero())
342342
return true;
343343
const SourceInfo &Loc = S.Current->getSource(OpPC);
344-
S.FFDiag(Loc, diag::note_constexpr_null_subobject) << CSK;
344+
S.FFDiag(Loc, diag::note_constexpr_null_subobject)
345+
<< CSK << S.Current->getRange(OpPC);
346+
345347
return false;
346348
}
347349

@@ -350,7 +352,8 @@ bool CheckRange(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
350352
if (!Ptr.isOnePastEnd())
351353
return true;
352354
const SourceInfo &Loc = S.Current->getSource(OpPC);
353-
S.FFDiag(Loc, diag::note_constexpr_access_past_end) << AK;
355+
S.FFDiag(Loc, diag::note_constexpr_access_past_end)
356+
<< AK << S.Current->getRange(OpPC);
354357
return false;
355358
}
356359

@@ -359,7 +362,8 @@ bool CheckRange(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
359362
if (!Ptr.isElementPastEnd())
360363
return true;
361364
const SourceInfo &Loc = S.Current->getSource(OpPC);
362-
S.FFDiag(Loc, diag::note_constexpr_past_end_subobject) << CSK;
365+
S.FFDiag(Loc, diag::note_constexpr_past_end_subobject)
366+
<< CSK << S.Current->getRange(OpPC);
363367
return false;
364368
}
365369

@@ -369,7 +373,8 @@ bool CheckSubobject(InterpState &S, CodePtr OpPC, const Pointer &Ptr,
369373
return true;
370374

371375
const SourceInfo &Loc = S.Current->getSource(OpPC);
372-
S.FFDiag(Loc, diag::note_constexpr_past_end_subobject) << CSK;
376+
S.FFDiag(Loc, diag::note_constexpr_past_end_subobject)
377+
<< CSK << S.Current->getRange(OpPC);
373378
return false;
374379
}
375380

0 commit comments

Comments
 (0)