[PATCH] D126929: Add sanitizer metadata attributes to clang IR gen.
Vitaly Buka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 10 17:56:47 PDT 2022
vitalybuka added inline comments.
================
Comment at: clang/lib/CodeGen/SanitizerMetadata.cpp:34
+
+static void expandKernelSanitizerMasks(SanitizerMask *Mask) {
+ if (*Mask & (SanitizerKind::Address | SanitizerKind::KernelAddress))
----------------
Prefer return value to output parameters:
```
SanitizerMask expandKernelSanitizerMasks(SanitizerMask Mask) {
if (Mask & (SanitizerKind::Address | SanitizerKind::KernelAddress))
Mask |= SanitizerKind::Address | SanitizerKind::KernelAddress;
return Mask;
}
```
================
Comment at: clang/lib/CodeGen/SanitizerMetadata.cpp:58-59
+
+ Meta.NoAddress |= NoSanitizeAttrSet.hasOneOf(SanitizerKind::Address |
+ SanitizerKind::KernelAddress);
+ Meta.NoAddress |= CGM.isInNoSanitizeList(
----------------
you don't need both here after expansion
you can either remove expandKernelSanitizerMasks(&NoSanitizeAttrMask);
or SanitizerKind::KernelAddress from here
================
Comment at: clang/lib/CodeGen/SanitizerMetadata.cpp:62
+ FsanitizeArgument.Mask &
+ (SanitizerKind::Address | SanitizerKind::KernelAddress),
+ GV, Loc, Ty);
----------------
same
================
Comment at: clang/lib/CodeGen/SanitizerMetadata.cpp:101
+ llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
+ llvm::Type::getInt1Ty(VMContext), Meta.IsDynInit)),
llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(
----------------
Meta.IsDynInit -> IsDynInit
they must be equal, and this legacy code better not use new Meta.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126929/new/
https://reviews.llvm.org/D126929
More information about the cfe-commits
mailing list