@@ -4238,18 +4238,19 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF,
42384238 PtrTy->getPointerAddressSpace ()))
42394239 return Ptr;
42404240 // The inbounds GEP of null is valid iff the index is zero.
4241+ auto CheckOrdinal = SanitizerKind::SO_PointerOverflow;
42414242 auto CheckHandler = SanitizerHandler::PointerOverflow;
4242- CodeGenFunction::SanitizerScope SanScope (
4243- &CGF, {SanitizerKind::SO_PointerOverflow}, CheckHandler);
4243+ CodeGenFunction::SanitizerScope SanScope (&CGF, {CheckOrdinal},
4244+ CheckHandler);
42444245 Value *IsZeroIndex = CGF.Builder .CreateIsNull (index);
42454246 llvm::Constant *StaticArgs[] = {
42464247 CGF.EmitCheckSourceLocation (op.E ->getExprLoc ())};
42474248 llvm::Type *IntPtrTy = DL.getIntPtrType (PtrTy);
42484249 Value *IntPtr = llvm::Constant::getNullValue (IntPtrTy);
42494250 Value *ComputedGEP = CGF.Builder .CreateZExtOrTrunc (index, IntPtrTy);
42504251 Value *DynamicArgs[] = {IntPtr, ComputedGEP};
4251- CGF.EmitCheck ({{IsZeroIndex, SanitizerKind::SO_PointerOverflow}} ,
4252- CheckHandler, StaticArgs, DynamicArgs);
4252+ CGF.EmitCheck ({{IsZeroIndex, CheckOrdinal}}, CheckHandler, StaticArgs ,
4253+ DynamicArgs);
42534254 return Ptr;
42544255 }
42554256
@@ -4770,16 +4771,16 @@ Value *ScalarExprEmitter::EmitShl(const BinOpInfo &Ops) {
47704771 RHS = ConstrainShiftValue (Ops.LHS , RHS, " shl.mask" );
47714772 else if ((SanitizeBase || SanitizeExponent) &&
47724773 isa<llvm::IntegerType>(Ops.LHS ->getType ())) {
4773- SmallVector<SanitizerKind::SanitizerOrdinal, 3 > Kinds ;
4774+ SmallVector<SanitizerKind::SanitizerOrdinal, 3 > Ordinals ;
47744775 if (SanitizeSignedBase)
4775- Kinds .push_back (SanitizerKind::SO_ShiftBase);
4776+ Ordinals .push_back (SanitizerKind::SO_ShiftBase);
47764777 if (SanitizeUnsignedBase)
4777- Kinds .push_back (SanitizerKind::SO_UnsignedShiftBase);
4778+ Ordinals .push_back (SanitizerKind::SO_UnsignedShiftBase);
47784779 if (SanitizeExponent)
4779- Kinds .push_back (SanitizerKind::SO_ShiftExponent);
4780+ Ordinals .push_back (SanitizerKind::SO_ShiftExponent);
47804781
47814782 CodeGenFunction::SanitizerScope SanScope (
4782- &CGF, Kinds , SanitizerHandler::ShiftOutOfBounds);
4783+ &CGF, Ordinals , SanitizerHandler::ShiftOutOfBounds);
47834784 SmallVector<std::pair<Value *, SanitizerKind::SanitizerOrdinal>, 2 > Checks;
47844785 bool RHSIsSigned = Ops.rhsHasSignedIntegerRepresentation ();
47854786 llvm::Value *WidthMinusOne =
0 commit comments