Skip to content

Commit 8510657

Browse files
committed
[BoundsSafety] Peek through BoundsCheckExpr in single->bidi->counted
This analysis is now done after inserting BoundsCheckExpr, so we need to peek through them to emit these warnings where we previously only had a BoundsSafetyPointerCast.
1 parent 79b1c8c commit 8510657

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

clang/lib/Sema/BoundsSafetySuggestions.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1594,6 +1594,10 @@ void UnsafeOperationVisitor::
15941594
Current = PE->getSubExpr();
15951595
continue;
15961596
}
1597+
if (const auto *BCE = dyn_cast<BoundsCheckExpr>(Current)) {
1598+
Current = BCE->getGuardedExpr();
1599+
continue;
1600+
}
15971601
if (const auto *CE = dyn_cast<CastExpr>(Current)) {
15981602
if (CE->getCastKind() == clang::CK_BoundsSafetyPointerCast) {
15991603
// Found a cast we might want to warn about.

0 commit comments

Comments
 (0)