Skip to content

Commit

Permalink
[PR] Test hasAnyFunctionEffects before iterating
Browse files Browse the repository at this point in the history
  • Loading branch information
cjappl committed Aug 9, 2024
1 parent 00d75e7 commit afa5a43
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions clang/lib/CodeGen/CodeGenFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -846,9 +846,12 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
Fn->addFnAttr(llvm::Attribute::ShadowCallStack);

if (SanOpts.has(SanitizerKind::Realtime)) {
for (const FunctionEffectWithCondition &Fe : FD->getFunctionEffects())
if (Fe.Effect.kind() == FunctionEffect::Kind::NonBlocking)
Fn->addFnAttr(llvm::Attribute::SanitizeRealtime);
if (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.
Expand Down

0 comments on commit afa5a43

Please sign in to comment.