aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--instrumentation/SanitizerCoverageLTO.so.cc8
-rw-r--r--instrumentation/afl-llvm-dict2file.so.cc7
-rw-r--r--instrumentation/afl-llvm-lto-instrumentation.so.cc11
-rw-r--r--instrumentation/afl-llvm-lto-instrumentlist.so.cc2
-rw-r--r--instrumentation/split-compares-pass.so.cc10
5 files changed, 21 insertions, 17 deletions
diff --git a/instrumentation/SanitizerCoverageLTO.so.cc b/instrumentation/SanitizerCoverageLTO.so.cc
index 960eb783..d90fa867 100644
--- a/instrumentation/SanitizerCoverageLTO.so.cc
+++ b/instrumentation/SanitizerCoverageLTO.so.cc
@@ -447,8 +447,7 @@ bool ModuleSanitizerCoverage::instrumentModule(
if ((ptr = getenv("AFL_LLVM_DOCUMENT_IDS")) != NULL) {
dFile.open(ptr, std::ofstream::out | std::ofstream::app);
- if (dFile.is_open())
- WARNF("Cannot access document file %s", ptr);
+ if (dFile.is_open()) WARNF("Cannot access document file %s", ptr);
}
@@ -1084,7 +1083,7 @@ bool ModuleSanitizerCoverage::instrumentModule(
if (count) {
- auto ptrhld = std::unique_ptr<char []>(new char[memlen + count]);
+ auto ptrhld = std::unique_ptr<char[]>(new char[memlen + count]);
count = 0;
@@ -1502,7 +1501,8 @@ void ModuleSanitizerCoverage::InjectCoverageAtBlock(Function &F, BasicBlock &BB,
unsigned long long int moduleID =
(((unsigned long long int)(rand() & 0xffffffff)) << 32) | getpid();
- dFile << "ModuleID=" << moduleID << " Function=" << F.getName().str() << " edgeID=" << afl_global_id << "\n";
+ dFile << "ModuleID=" << moduleID << " Function=" << F.getName().str()
+ << " edgeID=" << afl_global_id << "\n";
}
diff --git a/instrumentation/afl-llvm-dict2file.so.cc b/instrumentation/afl-llvm-dict2file.so.cc
index c4ad1783..0a3e74b9 100644
--- a/instrumentation/afl-llvm-dict2file.so.cc
+++ b/instrumentation/afl-llvm-dict2file.so.cc
@@ -65,8 +65,10 @@ using namespace llvm;
namespace {
class AFLdict2filePass : public ModulePass {
+
std::ofstream of;
- void dict2file(u8 *, u32);
+ void dict2file(u8 *, u32);
+
public:
static char ID;
@@ -147,8 +149,7 @@ bool AFLdict2filePass::runOnModule(Module &M) {
FATAL("AFL_LLVM_DICT2FILE is not set to an absolute path: %s", ptr);
of.open(ptr, std::ofstream::out | std::ofstream::app);
- if (!of.is_open())
- PFATAL("Could not open/create %s.", ptr);
+ if (!of.is_open()) PFATAL("Could not open/create %s.", ptr);
/* Instrument all the things! */
diff --git a/instrumentation/afl-llvm-lto-instrumentation.so.cc b/instrumentation/afl-llvm-lto-instrumentation.so.cc
index 4eb8424f..c2f61d34 100644
--- a/instrumentation/afl-llvm-lto-instrumentation.so.cc
+++ b/instrumentation/afl-llvm-lto-instrumentation.so.cc
@@ -138,8 +138,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
if ((ptr = getenv("AFL_LLVM_DOCUMENT_IDS")) != NULL) {
dFile.open(ptr, std::ofstream::out | std::ofstream::app);
- if (!dFile.is_open())
- WARNF("Cannot access document file %s", ptr);
+ if (!dFile.is_open()) WARNF("Cannot access document file %s", ptr);
}
@@ -246,8 +245,10 @@ bool AFLLTOPass::runOnModule(Module &M) {
AttributeList Attrs = F.getAttributes();
#if LLVM_VERSION_MAJOR < 14
if (Attrs.hasAttribute(-1, StringRef("skipinstrument"))) {
+
#else
if (Attrs.hasFnAttr(StringRef("skipinstrument"))) {
+
#endif
if (debug)
@@ -852,7 +853,9 @@ bool AFLLTOPass::runOnModule(Module &M) {
if (dFile.is_open()) {
- dFile << "ModuleID=" << moduleID << " Function=" << F.getName().str() << " edgeID=" << afl_global_id << "\n";
+ dFile << "ModuleID=" << moduleID
+ << " Function=" << F.getName().str()
+ << " edgeID=" << afl_global_id << "\n";
}
@@ -1019,7 +1022,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
if (count) {
- auto ptrhld = std::unique_ptr<char []>(new char[memlen + count]);
+ auto ptrhld = std::unique_ptr<char[]>(new char[memlen + count]);
count = 0;
diff --git a/instrumentation/afl-llvm-lto-instrumentlist.so.cc b/instrumentation/afl-llvm-lto-instrumentlist.so.cc
index 0ec0e427..ee2e5dd3 100644
--- a/instrumentation/afl-llvm-lto-instrumentlist.so.cc
+++ b/instrumentation/afl-llvm-lto-instrumentlist.so.cc
@@ -117,7 +117,7 @@ bool AFLcheckIfInstrument::runOnModule(Module &M) {
auto & Ctx = F.getContext();
AttributeList Attrs = F.getAttributes();
#if LLVM_VERSION_MAJOR < 14
- AttrBuilder NewAttrs;
+ AttrBuilder NewAttrs;
NewAttrs.addAttribute("skipinstrument");
F.setAttributes(
Attrs.addAttributes(Ctx, AttributeList::FunctionIndex, NewAttrs));
diff --git a/instrumentation/split-compares-pass.so.cc b/instrumentation/split-compares-pass.so.cc
index 13f45b69..e63be98c 100644
--- a/instrumentation/split-compares-pass.so.cc
+++ b/instrumentation/split-compares-pass.so.cc
@@ -578,16 +578,16 @@ bool SplitComparesTransform::splitCompare(CmpInst *cmp_inst, Module &M,
/* dependent on the cmp of the high parts go to the end or go on with
* the comparison */
- auto term = bb->getTerminator();
- BranchInst *br = nullptr;
+ auto term = bb->getTerminator();
+
if (pred == CmpInst::ICMP_EQ) {
- br = BranchInst::Create(cmp_low_bb, end_bb, icmp_high, bb);
+ BranchInst::Create(cmp_low_bb, end_bb, icmp_high, bb);
} else {
- /* CmpInst::ICMP_NE */
- br = BranchInst::Create(end_bb, cmp_low_bb, icmp_high, bb);
+ // CmpInst::ICMP_NE
+ BranchInst::Create(end_bb, cmp_low_bb, icmp_high, bb);
}