mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-18 04:38:08 +00:00
LLVM cmplog factoring custom Instruction iterator with added restriction
This commit is contained in:
@ -582,6 +582,24 @@ bool isInInstrumentList(llvm::Function *F, std::string Filename) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class Iterator>
|
||||||
|
Iterator Unique(Iterator first, Iterator last) {
|
||||||
|
static_assert(std::is_trivially_copyable<
|
||||||
|
typename std::iterator_traits<Iterator>
|
||||||
|
>::value_type, "Invalid underlying type");
|
||||||
|
|
||||||
|
while (first != last) {
|
||||||
|
|
||||||
|
Iterator next(first);
|
||||||
|
last = std::remove(++next, last, *first);
|
||||||
|
first = next;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return last;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate the number of average collisions that would occur if all
|
// Calculate the number of average collisions that would occur if all
|
||||||
// location IDs would be assigned randomly (like normal afl/afl++).
|
// location IDs would be assigned randomly (like normal afl/afl++).
|
||||||
// This uses the "balls in bins" algorithm.
|
// This uses the "balls in bins" algorithm.
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <type_traits>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include "llvm/Config/llvm-config.h"
|
#include "llvm/Config/llvm-config.h"
|
||||||
@ -53,6 +54,7 @@ void initInstrumentList();
|
|||||||
bool isInInstrumentList(llvm::Function *F, std::string Filename);
|
bool isInInstrumentList(llvm::Function *F, std::string Filename);
|
||||||
unsigned long long int calculateCollisions(uint32_t edges);
|
unsigned long long int calculateCollisions(uint32_t edges);
|
||||||
void scanForDangerousFunctions(llvm::Module *M);
|
void scanForDangerousFunctions(llvm::Module *M);
|
||||||
|
template<class Iterator> Iterator Unique(Iterator, Iterator);
|
||||||
|
|
||||||
#ifndef IS_EXTERN
|
#ifndef IS_EXTERN
|
||||||
#define IS_EXTERN
|
#define IS_EXTERN
|
||||||
|
@ -138,21 +138,6 @@ llvmGetPassPluginInfo() {
|
|||||||
char CmpLogInstructions::ID = 0;
|
char CmpLogInstructions::ID = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <class Iterator>
|
|
||||||
Iterator Unique(Iterator first, Iterator last) {
|
|
||||||
|
|
||||||
while (first != last) {
|
|
||||||
|
|
||||||
Iterator next(first);
|
|
||||||
last = std::remove(++next, last, *first);
|
|
||||||
first = next;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return last;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CmpLogInstructions::hookInstrs(Module &M) {
|
bool CmpLogInstructions::hookInstrs(Module &M) {
|
||||||
|
|
||||||
std::vector<Instruction *> icomps;
|
std::vector<Instruction *> icomps;
|
||||||
|
@ -131,21 +131,6 @@ llvmGetPassPluginInfo() {
|
|||||||
char CmplogSwitches::ID = 0;
|
char CmplogSwitches::ID = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <class Iterator>
|
|
||||||
Iterator Unique(Iterator first, Iterator last) {
|
|
||||||
|
|
||||||
while (first != last) {
|
|
||||||
|
|
||||||
Iterator next(first);
|
|
||||||
last = std::remove(++next, last, *first);
|
|
||||||
first = next;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return last;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CmplogSwitches::hookInstrs(Module &M) {
|
bool CmplogSwitches::hookInstrs(Module &M) {
|
||||||
|
|
||||||
std::vector<SwitchInst *> switches;
|
std::vector<SwitchInst *> switches;
|
||||||
|
Reference in New Issue
Block a user