[llvm] f28ed7f - [NFC][HWASAN] make variables names for callback functions more consistent
via llvm-commits
llvm-commits at lists.llvm.org
Tue May 30 23:04:50 PDT 2023
Author: Enna1
Date: 2023-05-31T14:04:12+08:00
New Revision: f28ed7f695288eba2b0e22996de92df5f7ef6368
URL: https://github.com/llvm/llvm-project/commit/f28ed7f695288eba2b0e22996de92df5f7ef6368
DIFF: https://github.com/llvm/llvm-project/commit/f28ed7f695288eba2b0e22996de92df5f7ef6368.diff
LOG: [NFC][HWASAN] make variables names for callback functions more consistent
This patch makes the variables names for callback functions more consistent. Changes no functionality.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D151605
Added:
Modified:
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 2ad090b0a274a..28db47a190927 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -337,8 +337,6 @@ class HWAddressSanitizer {
Module &M;
const StackSafetyGlobalInfo *SSI;
Triple TargetTriple;
- FunctionCallee HWAsanMemmove, HWAsanMemcpy, HWAsanMemset;
- FunctionCallee HWAsanHandleVfork;
/// This struct defines the shadow mapping using the rule:
/// shadow = (mem >> Scale) + Offset.
@@ -392,6 +390,9 @@ class HWAddressSanitizer {
FunctionCallee HwasanMemoryAccessCallback[2][kNumberOfAccessSizes];
FunctionCallee HwasanMemoryAccessCallbackSized[2];
+ FunctionCallee HwasanMemmove, HwasanMemcpy, HwasanMemset;
+ FunctionCallee HwasanHandleVfork;
+
FunctionCallee HwasanTagMemoryFunc;
FunctionCallee HwasanGenerateTagFunc;
FunctionCallee HwasanRecordFrameRecordFunc;
@@ -625,25 +626,25 @@ void HWAddressSanitizer::initializeCallbacks(Module &M) {
IRBuilder<> IRB(*C);
const std::string MatchAllStr = UseMatchAllCallback ? "_match_all" : "";
FunctionType *HwasanMemoryAccessCallbackSizedFnTy,
- *HwasanMemoryAccessCallbackFnTy, *HWAsanMemTransferFnTy,
- *HWAsanMemsetFnTy;
+ *HwasanMemoryAccessCallbackFnTy, *HwasanMemTransferFnTy,
+ *HwasanMemsetFnTy;
if (UseMatchAllCallback) {
HwasanMemoryAccessCallbackSizedFnTy =
FunctionType::get(VoidTy, {IntptrTy, IntptrTy, Int8Ty}, false);
HwasanMemoryAccessCallbackFnTy =
FunctionType::get(VoidTy, {IntptrTy, Int8Ty}, false);
- HWAsanMemTransferFnTy = FunctionType::get(
+ HwasanMemTransferFnTy = FunctionType::get(
Int8PtrTy, {Int8PtrTy, Int8PtrTy, IntptrTy, Int8Ty}, false);
- HWAsanMemsetFnTy = FunctionType::get(
+ HwasanMemsetFnTy = FunctionType::get(
Int8PtrTy, {Int8PtrTy, Int32Ty, IntptrTy, Int8Ty}, false);
} else {
HwasanMemoryAccessCallbackSizedFnTy =
FunctionType::get(VoidTy, {IntptrTy, IntptrTy}, false);
HwasanMemoryAccessCallbackFnTy =
FunctionType::get(VoidTy, {IntptrTy}, false);
- HWAsanMemTransferFnTy =
+ HwasanMemTransferFnTy =
FunctionType::get(Int8PtrTy, {Int8PtrTy, Int8PtrTy, IntptrTy}, false);
- HWAsanMemsetFnTy =
+ HwasanMemsetFnTy =
FunctionType::get(Int8PtrTy, {Int8PtrTy, Int32Ty, IntptrTy}, false);
}
@@ -670,12 +671,12 @@ void HWAddressSanitizer::initializeCallbacks(Module &M) {
? std::string("")
: ClMemoryAccessCallbackPrefix;
- HWAsanMemmove = M.getOrInsertFunction(
- MemIntrinCallbackPrefix + "memmove" + MatchAllStr, HWAsanMemTransferFnTy);
- HWAsanMemcpy = M.getOrInsertFunction(
- MemIntrinCallbackPrefix + "memcpy" + MatchAllStr, HWAsanMemTransferFnTy);
- HWAsanMemset = M.getOrInsertFunction(
- MemIntrinCallbackPrefix + "memset" + MatchAllStr, HWAsanMemsetFnTy);
+ HwasanMemmove = M.getOrInsertFunction(
+ MemIntrinCallbackPrefix + "memmove" + MatchAllStr, HwasanMemTransferFnTy);
+ HwasanMemcpy = M.getOrInsertFunction(
+ MemIntrinCallbackPrefix + "memcpy" + MatchAllStr, HwasanMemTransferFnTy);
+ HwasanMemset = M.getOrInsertFunction(
+ MemIntrinCallbackPrefix + "memset" + MatchAllStr, HwasanMemsetFnTy);
HwasanTagMemoryFunc = M.getOrInsertFunction("__hwasan_tag_memory", VoidTy,
Int8PtrTy, Int8Ty, IntptrTy);
@@ -688,7 +689,7 @@ void HWAddressSanitizer::initializeCallbacks(Module &M) {
ShadowGlobal =
M.getOrInsertGlobal("__hwasan_shadow", ArrayType::get(Int8Ty, 0));
- HWAsanHandleVfork =
+ HwasanHandleVfork =
M.getOrInsertFunction("__hwasan_handle_vfork", VoidTy, IntptrTy);
}
@@ -959,14 +960,14 @@ void HWAddressSanitizer::instrumentMemIntrinsic(MemIntrinsic *MI) {
if (isa<MemTransferInst>(MI)) {
if (UseMatchAllCallback) {
IRB.CreateCall(
- isa<MemMoveInst>(MI) ? HWAsanMemmove : HWAsanMemcpy,
+ isa<MemMoveInst>(MI) ? HwasanMemmove : HwasanMemcpy,
{IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy()),
IRB.CreatePointerCast(MI->getOperand(1), IRB.getInt8PtrTy()),
IRB.CreateIntCast(MI->getOperand(2), IntptrTy, false),
ConstantInt::get(Int8Ty, *MatchAllTag)});
} else {
IRB.CreateCall(
- isa<MemMoveInst>(MI) ? HWAsanMemmove : HWAsanMemcpy,
+ isa<MemMoveInst>(MI) ? HwasanMemmove : HwasanMemcpy,
{IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy()),
IRB.CreatePointerCast(MI->getOperand(1), IRB.getInt8PtrTy()),
IRB.CreateIntCast(MI->getOperand(2), IntptrTy, false)});
@@ -974,14 +975,14 @@ void HWAddressSanitizer::instrumentMemIntrinsic(MemIntrinsic *MI) {
} else if (isa<MemSetInst>(MI)) {
if (UseMatchAllCallback) {
IRB.CreateCall(
- HWAsanMemset,
+ HwasanMemset,
{IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy()),
IRB.CreateIntCast(MI->getOperand(1), IRB.getInt32Ty(), false),
IRB.CreateIntCast(MI->getOperand(2), IntptrTy, false),
ConstantInt::get(Int8Ty, *MatchAllTag)});
} else {
IRB.CreateCall(
- HWAsanMemset,
+ HwasanMemset,
{IRB.CreatePointerCast(MI->getOperand(0), IRB.getInt8PtrTy()),
IRB.CreateIntCast(MI->getOperand(1), IRB.getInt32Ty(), false),
IRB.CreateIntCast(MI->getOperand(2), IntptrTy, false)});
@@ -1326,7 +1327,7 @@ bool HWAddressSanitizer::instrumentLandingPads(
for (auto *LP : LandingPadVec) {
IRBuilder<> IRB(LP->getNextNode());
IRB.CreateCall(
- HWAsanHandleVfork,
+ HwasanHandleVfork,
{readRegister(IRB, (TargetTriple.getArch() == Triple::x86_64) ? "rsp"
: "sp")});
}
More information about the llvm-commits
mailing list