code format

This commit is contained in:
vanhauser-thc
2022-03-01 20:13:57 +01:00
parent 5e9286b9ea
commit d325fa5db8
3 changed files with 36 additions and 28 deletions

View File

@ -62,12 +62,14 @@ namespace {
#if LLVM_MAJOR >= 11 /* use new pass manager */
class CmpLogInstructions : public PassInfoMixin<CmpLogInstructions> {
public:
CmpLogInstructions() {
initInstrumentList();
}
#else
class CmpLogInstructions : public ModulePass {
@ -78,6 +80,7 @@ class CmpLogInstructions : public ModulePass {
initInstrumentList();
}
#endif
#if LLVM_MAJOR >= 11 /* use new pass manager */
@ -85,16 +88,17 @@ class CmpLogInstructions : public ModulePass {
#else
bool runOnModule(Module &M) override;
#if LLVM_VERSION_MAJOR >= 4
#if LLVM_VERSION_MAJOR >= 4
StringRef getPassName() const override {
#else
#else
const char *getPassName() const override {
#endif
#endif
return "cmplog instructions";
}
#endif
private:
@ -637,8 +641,10 @@ bool CmpLogInstructions::hookInstrs(Module &M) {
#if LLVM_MAJOR >= 11 /* use new pass manager */
PreservedAnalyses CmpLogInstructions::run(Module & M,
ModuleAnalysisManager &MAM) {
#else
bool CmpLogInstructions::runOnModule(Module &M) {
#endif
if (getenv("AFL_QUIET") == NULL)
@ -671,9 +677,10 @@ static RegisterStandardPasses RegisterCmpLogInstructionsPass(
static RegisterStandardPasses RegisterCmpLogInstructionsPass0(
PassManagerBuilder::EP_EnabledOnOptLevel0, registerCmpLogInstructionsPass);
#if LLVM_VERSION_MAJOR >= 11
#if LLVM_VERSION_MAJOR >= 11
static RegisterStandardPasses RegisterCmpLogInstructionsPassLTO(
PassManagerBuilder::EP_FullLinkTimeOptimizationLast,
registerCmpLogInstructionsPass);
#endif
#endif
#endif

View File

@ -81,27 +81,28 @@ class CompareTransform : public ModulePass {
}
#if LLVM_MAJOR < 11
#if LLVM_VERSION_MAJOR >= 4
#if LLVM_VERSION_MAJOR >= 4
StringRef getPassName() const override {
#else
#else
const char *getPassName() const override {
#endif
#endif
#endif
#if LLVM_MAJOR >= 11 /* use new pass manager */
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM);
PreservedAnalyses run(Module & M, ModuleAnalysisManager & MAM);
#else
bool runOnModule(Module &M) override;
#endif
private:
bool transformCmps(Module &M, const bool processStrcmp,
bool transformCmps(Module & M, const bool processStrcmp,
const bool processMemcmp, const bool processStrncmp,
const bool processStrcasecmp,
const bool processStrncasecmp);
};
};
} // namespace
@ -170,7 +171,7 @@ bool CompareTransform::transformCmps(Module &M, const bool processStrcmp,
#if LLVM_VERSION_MAJOR >= 9
FunctionCallee tolowerFn;
#else
Function * tolowerFn;
Function *tolowerFn;
#endif
{

View File

@ -684,8 +684,8 @@ static void edit_params(u32 argc, char **argv, char **envp) {
#if LLVM_MAJOR >= 11
cc_params[cc_par_cnt++] = "-fexperimental-new-pass-manager";
cc_params[cc_par_cnt++] =
alloc_printf("-fpass-plugin=%s/cmplog-instructions-pass.so", obj_path);
cc_params[cc_par_cnt++] = alloc_printf(
"-fpass-plugin=%s/cmplog-instructions-pass.so", obj_path);
#else
cc_params[cc_par_cnt++] = "-Xclang";
cc_params[cc_par_cnt++] = "-load";