r314751 - [ubsan] Save the result of getLLVMContext. NFC.
Vedant Kumar via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 2 18:27:26 PDT 2017
Author: vedantk
Date: Mon Oct 2 18:27:26 2017
New Revision: 314751
URL: http://llvm.org/viewvc/llvm-project?rev=314751&view=rev
Log:
[ubsan] Save the result of getLLVMContext. NFC.
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=314751&r1=314750&r2=314751&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Oct 2 18:27:26 2017
@@ -1460,17 +1460,17 @@ bool CodeGenFunction::EmitScalarRangeChe
if (!getRangeForType(*this, Ty, Min, End, /*StrictEnums=*/true, IsBool))
return true;
+ auto &Ctx = getLLVMContext();
SanitizerScope SanScope(this);
llvm::Value *Check;
--End;
if (!Min) {
- Check = Builder.CreateICmpULE(
- Value, llvm::ConstantInt::get(getLLVMContext(), End));
+ Check = Builder.CreateICmpULE(Value, llvm::ConstantInt::get(Ctx, End));
} else {
- llvm::Value *Upper = Builder.CreateICmpSLE(
- Value, llvm::ConstantInt::get(getLLVMContext(), End));
- llvm::Value *Lower = Builder.CreateICmpSGE(
- Value, llvm::ConstantInt::get(getLLVMContext(), Min));
+ llvm::Value *Upper =
+ Builder.CreateICmpSLE(Value, llvm::ConstantInt::get(Ctx, End));
+ llvm::Value *Lower =
+ Builder.CreateICmpSGE(Value, llvm::ConstantInt::get(Ctx, Min));
Check = Builder.CreateAnd(Upper, Lower);
}
llvm::Constant *StaticArgs[] = {EmitCheckSourceLocation(Loc),
More information about the cfe-commits
mailing list