mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-16 20:08:07 +00:00
code format
This commit is contained in:
@ -60,14 +60,16 @@ using namespace llvm;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#if LLVM_MAJOR >= 11 /* use new pass manager */
|
#if LLVM_MAJOR >= 11 /* use new pass manager */
|
||||||
class CmpLogInstructions : public PassInfoMixin<CmpLogInstructions> {
|
class CmpLogInstructions : public PassInfoMixin<CmpLogInstructions> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CmpLogInstructions() {
|
CmpLogInstructions() {
|
||||||
|
|
||||||
initInstrumentList();
|
initInstrumentList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
class CmpLogInstructions : public ModulePass {
|
class CmpLogInstructions : public ModulePass {
|
||||||
|
|
||||||
@ -78,23 +80,25 @@ class CmpLogInstructions : public ModulePass {
|
|||||||
initInstrumentList();
|
initInstrumentList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LLVM_MAJOR >= 11 /* use new pass manager */
|
#if LLVM_MAJOR >= 11 /* use new pass manager */
|
||||||
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
|
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
|
||||||
#else
|
#else
|
||||||
bool runOnModule(Module &M) override;
|
bool runOnModule(Module &M) override;
|
||||||
|
|
||||||
#if LLVM_VERSION_MAJOR >= 4
|
#if LLVM_VERSION_MAJOR >= 4
|
||||||
StringRef getPassName() const override {
|
StringRef getPassName() const override {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
const char *getPassName() const override {
|
const char *getPassName() const override {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return "cmplog instructions";
|
return "cmplog instructions";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -104,7 +108,7 @@ class CmpLogInstructions : public ModulePass {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#if LLVM_MAJOR <= 10 /* use old pass manager */
|
#if LLVM_MAJOR <= 10 /* use old pass manager */
|
||||||
char CmpLogInstructions::ID = 0;
|
char CmpLogInstructions::ID = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -634,11 +638,13 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LLVM_MAJOR >= 11 /* use new pass manager */
|
#if LLVM_MAJOR >= 11 /* use new pass manager */
|
||||||
PreservedAnalyses CmpLogInstructions::run(Module & M,
|
PreservedAnalyses CmpLogInstructions::run(Module & M,
|
||||||
ModuleAnalysisManager &MAM) {
|
ModuleAnalysisManager &MAM) {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
bool CmpLogInstructions::runOnModule(Module &M) {
|
bool CmpLogInstructions::runOnModule(Module &M) {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (getenv("AFL_QUIET") == NULL)
|
if (getenv("AFL_QUIET") == NULL)
|
||||||
@ -648,7 +654,7 @@ bool CmpLogInstructions::runOnModule(Module &M) {
|
|||||||
hookInstrs(M);
|
hookInstrs(M);
|
||||||
verifyModule(M);
|
verifyModule(M);
|
||||||
|
|
||||||
#if LLVM_MAJOR >= 11 /* use new pass manager */
|
#if LLVM_MAJOR >= 11 /* use new pass manager */
|
||||||
return PreservedAnalyses::all();
|
return PreservedAnalyses::all();
|
||||||
#else
|
#else
|
||||||
return true;
|
return true;
|
||||||
@ -671,9 +677,10 @@ static RegisterStandardPasses RegisterCmpLogInstructionsPass(
|
|||||||
static RegisterStandardPasses RegisterCmpLogInstructionsPass0(
|
static RegisterStandardPasses RegisterCmpLogInstructionsPass0(
|
||||||
PassManagerBuilder::EP_EnabledOnOptLevel0, registerCmpLogInstructionsPass);
|
PassManagerBuilder::EP_EnabledOnOptLevel0, registerCmpLogInstructionsPass);
|
||||||
|
|
||||||
#if LLVM_VERSION_MAJOR >= 11
|
#if LLVM_VERSION_MAJOR >= 11
|
||||||
static RegisterStandardPasses RegisterCmpLogInstructionsPassLTO(
|
static RegisterStandardPasses RegisterCmpLogInstructionsPassLTO(
|
||||||
PassManagerBuilder::EP_FullLinkTimeOptimizationLast,
|
PassManagerBuilder::EP_FullLinkTimeOptimizationLast,
|
||||||
registerCmpLogInstructionsPass);
|
registerCmpLogInstructionsPass);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
@ -81,27 +81,28 @@ class CompareTransform : public ModulePass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if LLVM_MAJOR < 11
|
#if LLVM_MAJOR < 11
|
||||||
#if LLVM_VERSION_MAJOR >= 4
|
#if LLVM_VERSION_MAJOR >= 4
|
||||||
StringRef getPassName() const override {
|
StringRef getPassName() const override {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
const char *getPassName() const override {
|
const char *getPassName() const override {
|
||||||
#endif
|
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LLVM_MAJOR >= 11 /* use new pass manager */
|
#if LLVM_MAJOR >= 11 /* use new pass manager */
|
||||||
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
|
PreservedAnalyses run(Module & M, ModuleAnalysisManager & MAM);
|
||||||
#else
|
#else
|
||||||
bool runOnModule(Module &M) override;
|
bool runOnModule(Module &M) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool transformCmps(Module &M, const bool processStrcmp,
|
bool transformCmps(Module & M, const bool processStrcmp,
|
||||||
const bool processMemcmp, const bool processStrncmp,
|
const bool processMemcmp, const bool processStrncmp,
|
||||||
const bool processStrcasecmp,
|
const bool processStrcasecmp,
|
||||||
const bool processStrncasecmp);
|
const bool processStrncasecmp);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
@ -170,7 +171,7 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp,
|
|||||||
#if LLVM_VERSION_MAJOR >= 9
|
#if LLVM_VERSION_MAJOR >= 9
|
||||||
FunctionCallee tolowerFn;
|
FunctionCallee tolowerFn;
|
||||||
#else
|
#else
|
||||||
Function * tolowerFn;
|
Function *tolowerFn;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
|
10
src/afl-cc.c
10
src/afl-cc.c
@ -462,7 +462,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
#if LLVM_MAJOR >= 11 /* use new pass manager */
|
#if LLVM_MAJOR >= 11 /* use new pass manager */
|
||||||
cc_params[cc_par_cnt++] = "-fexperimental-new-pass-manager";
|
cc_params[cc_par_cnt++] = "-fexperimental-new-pass-manager";
|
||||||
cc_params[cc_par_cnt++] =
|
cc_params[cc_par_cnt++] =
|
||||||
alloc_printf("-fpass-plugin=%s/split-switches-pass.so", obj_path);
|
alloc_printf("-fpass-plugin=%s/split-switches-pass.so", obj_path);
|
||||||
@ -488,7 +488,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
#if LLVM_MAJOR >= 11 /* use new pass manager */
|
#if LLVM_MAJOR >= 11 /* use new pass manager */
|
||||||
cc_params[cc_par_cnt++] = "-fexperimental-new-pass-manager";
|
cc_params[cc_par_cnt++] = "-fexperimental-new-pass-manager";
|
||||||
cc_params[cc_par_cnt++] = alloc_printf(
|
cc_params[cc_par_cnt++] = alloc_printf(
|
||||||
"-fpass-plugin=%s/compare-transform-pass.so", obj_path);
|
"-fpass-plugin=%s/compare-transform-pass.so", obj_path);
|
||||||
@ -571,7 +571,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LLVM_MAJOR == 13 // TODO: set to 14 when done FIXME
|
#if LLVM_MAJOR == 13 // TODO: set to 14 when done FIXME
|
||||||
// Use the old pass manager in LLVM 13 which the afl++ passes still use.
|
// Use the old pass manager in LLVM 13 which the afl++ passes still use.
|
||||||
cc_params[cc_par_cnt++] = "-flegacy-pass-manager";
|
cc_params[cc_par_cnt++] = "-flegacy-pass-manager";
|
||||||
#endif
|
#endif
|
||||||
@ -684,8 +684,8 @@ static void edit_params(u32 argc, char **argv, char **envp) {
|
|||||||
|
|
||||||
#if LLVM_MAJOR >= 11
|
#if LLVM_MAJOR >= 11
|
||||||
cc_params[cc_par_cnt++] = "-fexperimental-new-pass-manager";
|
cc_params[cc_par_cnt++] = "-fexperimental-new-pass-manager";
|
||||||
cc_params[cc_par_cnt++] =
|
cc_params[cc_par_cnt++] = alloc_printf(
|
||||||
alloc_printf("-fpass-plugin=%s/cmplog-instructions-pass.so", obj_path);
|
"-fpass-plugin=%s/cmplog-instructions-pass.so", obj_path);
|
||||||
#else
|
#else
|
||||||
cc_params[cc_par_cnt++] = "-Xclang";
|
cc_params[cc_par_cnt++] = "-Xclang";
|
||||||
cc_params[cc_par_cnt++] = "-load";
|
cc_params[cc_par_cnt++] = "-load";
|
||||||
|
Reference in New Issue
Block a user