summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorMatt Morehouse <mascasa@google.com>2018-03-23 23:35:28 +0000
committerMatt Morehouse <mascasa@google.com>2018-03-23 23:35:28 +0000
commit5317f2e4c907fd1eca64772bdd2c23364adfaa77 (patch)
treeeb4d5ae1ea89856bca2b5eac1b5d3ff928709814 /clang/lib/CodeGen/CodeGenFunction.cpp
parent953d843dfb7b4924346031b8a3b586ec06a5ebde (diff)
downloadbcm5719-llvm-5317f2e4c907fd1eca64772bdd2c23364adfaa77.tar.gz
bcm5719-llvm-5317f2e4c907fd1eca64772bdd2c23364adfaa77.zip
[libFuzzer] Use OptForFuzzing attribute with -fsanitize=fuzzer.
Summary: Disables certain CMP optimizations to improve fuzzing signal under -O1 and -O2. Switches all fuzzer tests to -O2 except for a few leak tests where the leak is optimized out under -O2. Reviewers: kcc, vitalybuka Reviewed By: vitalybuka Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D44798 llvm-svn: 328384
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index c5de16bc6eb..3d7b9065876 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -862,6 +862,10 @@ void CodeGenFunction::StartFunction(GlobalDecl GD,
if (SanOpts.has(SanitizerKind::SafeStack))
Fn->addFnAttr(llvm::Attribute::SafeStack);
+ // Apply fuzzing attribute to the function.
+ if (SanOpts.hasOneOf(SanitizerKind::Fuzzer | SanitizerKind::FuzzerNoLink))
+ Fn->addFnAttr(llvm::Attribute::OptForFuzzing);
+
// Ignore TSan memory acesses from within ObjC/ObjC++ dealloc, initialize,
// .cxx_destruct, __destroy_helper_block_ and all of their calees at run time.
if (SanOpts.has(SanitizerKind::Thread)) {
OpenPOWER on IntegriCloud