aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorChris Apple <cja-private@pm.me>2024-08-23 08:16:52 -0700
committerGitHub <noreply@github.com>2024-08-23 08:16:52 -0700
commitf77e8f765e425a575516c16e7034cb448d270fcc (patch)
tree766df2827d3fb8510aedd7710cef04a4105fd708 /clang/lib/CodeGen/CodeGenFunction.cpp
parent6a8f73803a32db75d22490d341bf8744722a9025 (diff)
downloadllvm-f77e8f765e425a575516c16e7034cb448d270fcc.zip
llvm-f77e8f765e425a575516c16e7034cb448d270fcc.tar.gz
llvm-f77e8f765e425a575516c16e7034cb448d270fcc.tar.bz2
[clang][rtsan] Reland realtime sanitizer codegen and driver (#102622)
This reverts commit a1e9b7e646b76bf844e8a9a101ebd27de11992ff This relands commit d010ec6af8162a8ae4e42d2cac5282f83db0ce07 No modifications from the original patch. It was determined that the ubsan build failure was happening even after the revert, some examples: https://lab.llvm.org/buildbot/#/builders/159/builds/4477 https://lab.llvm.org/buildbot/#/builders/159/builds/4478 https://lab.llvm.org/buildbot/#/builders/159/builds/4479
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index eff8c9f..c89eaa0 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -845,6 +845,13 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
if (SanOpts.has(SanitizerKind::ShadowCallStack))
Fn->addFnAttr(llvm::Attribute::ShadowCallStack);
+ if (SanOpts.has(SanitizerKind::Realtime))
+ if (FD && FD->getASTContext().hasAnyFunctionEffects())
+ for (const FunctionEffectWithCondition &Fe : FD->getFunctionEffects()) {
+ if (Fe.Effect.kind() == FunctionEffect::Kind::NonBlocking)
+ Fn->addFnAttr(llvm::Attribute::SanitizeRealtime);
+ }
+
// Apply fuzzing attribute to the function.
if (SanOpts.hasOneOf(SanitizerKind::Fuzzer | SanitizerKind::FuzzerNoLink))
Fn->addFnAttr(llvm::Attribute::OptForFuzzing);