aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 39c3aa2..3cc61b1 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5954,6 +5954,9 @@ bool Sema::BuiltinAssumeAligned(CallExpr *TheCall) {
if (Result > Sema::MaximumAlignment)
Diag(TheCall->getBeginLoc(), diag::warn_assume_aligned_too_great)
<< SecondArg->getSourceRange() << Sema::MaximumAlignment;
+
+ TheCall->setArg(1,
+ ConstantExpr::Create(Context, SecondArg, APValue(Result)));
}
if (NumArgs > 2) {
@@ -14881,13 +14884,11 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
// Diag message shows element size in bits and in "bytes" (platform-
// dependent CharUnits)
DiagRuntimeBehavior(BaseExpr->getBeginLoc(), BaseExpr,
- PDiag(DiagID)
- << toString(index, 10, true) << AddrBits
- << (unsigned)ASTC.toBits(*ElemCharUnits)
- << toString(ElemBytes, 10, false)
- << toString(MaxElems, 10, false)
- << (unsigned)MaxElems.getLimitedValue(~0U)
- << IndexExpr->getSourceRange());
+ PDiag(DiagID) << index << AddrBits
+ << (unsigned)ASTC.toBits(*ElemCharUnits)
+ << ElemBytes << MaxElems
+ << MaxElems.getZExtValue()
+ << IndexExpr->getSourceRange());
const NamedDecl *ND = nullptr;
// Try harder to find a NamedDecl to point at in the note.
@@ -14970,10 +14971,10 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
unsigned CastMsg = (!ASE || BaseType == EffectiveType) ? 0 : 1;
QualType CastMsgTy = ASE ? ASE->getLHS()->getType() : QualType();
- DiagRuntimeBehavior(
- BaseExpr->getBeginLoc(), BaseExpr,
- PDiag(DiagID) << toString(index, 10, true) << ArrayTy->desugar()
- << CastMsg << CastMsgTy << IndexExpr->getSourceRange());
+ DiagRuntimeBehavior(BaseExpr->getBeginLoc(), BaseExpr,
+ PDiag(DiagID)
+ << index << ArrayTy->desugar() << CastMsg
+ << CastMsgTy << IndexExpr->getSourceRange());
} else {
unsigned DiagID = diag::warn_array_index_precedes_bounds;
if (!ASE) {
@@ -14982,8 +14983,7 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
}
DiagRuntimeBehavior(BaseExpr->getBeginLoc(), BaseExpr,
- PDiag(DiagID) << toString(index, 10, true)
- << IndexExpr->getSourceRange());
+ PDiag(DiagID) << index << IndexExpr->getSourceRange());
}
const NamedDecl *ND = nullptr;
@@ -15946,7 +15946,7 @@ void Sema::RefersToMemberWithReducedAlignment(
}
// Check if the synthesized offset fulfills the alignment.
- if (Offset % ExpectedAlignment != 0 ||
+ if (!Offset.isMultipleOf(ExpectedAlignment) ||
// It may fulfill the offset it but the effective alignment may still be
// lower than the expected expression alignment.
CompleteObjectAlignment < ExpectedAlignment) {