Skip to content

Commit 0e21cdb

Browse files
committed
Use operator<< for APSInt/APInt in array access diagnostics
1 parent 133406e commit 0e21cdb

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

clang/lib/Sema/SemaChecking.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14882,7 +14882,7 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
1488214882
// dependent CharUnits)
1488314883
DiagRuntimeBehavior(BaseExpr->getBeginLoc(), BaseExpr,
1488414884
PDiag(DiagID)
14885-
<< toString(index, 10, true) << AddrBits
14885+
<< index << AddrBits
1488614886
<< (unsigned)ASTC.toBits(*ElemCharUnits)
1488714887
<< toString(ElemBytes, 10, false)
1488814888
<< toString(MaxElems, 10, false)
@@ -14970,10 +14970,10 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
1497014970
unsigned CastMsg = (!ASE || BaseType == EffectiveType) ? 0 : 1;
1497114971
QualType CastMsgTy = ASE ? ASE->getLHS()->getType() : QualType();
1497214972

14973-
DiagRuntimeBehavior(
14974-
BaseExpr->getBeginLoc(), BaseExpr,
14975-
PDiag(DiagID) << toString(index, 10, true) << ArrayTy->desugar()
14976-
<< CastMsg << CastMsgTy << IndexExpr->getSourceRange());
14973+
DiagRuntimeBehavior(BaseExpr->getBeginLoc(), BaseExpr,
14974+
PDiag(DiagID)
14975+
<< index << ArrayTy->desugar() << CastMsg
14976+
<< CastMsgTy << IndexExpr->getSourceRange());
1497714977
} else {
1497814978
unsigned DiagID = diag::warn_array_index_precedes_bounds;
1497914979
if (!ASE) {
@@ -14982,8 +14982,7 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
1498214982
}
1498314983

1498414984
DiagRuntimeBehavior(BaseExpr->getBeginLoc(), BaseExpr,
14985-
PDiag(DiagID) << toString(index, 10, true)
14986-
<< IndexExpr->getSourceRange());
14985+
PDiag(DiagID) << index << IndexExpr->getSourceRange());
1498714986
}
1498814987

1498914988
const NamedDecl *ND = nullptr;

0 commit comments

Comments
 (0)