diff options
author | van Hauser <vh@thc.org> | 2023-02-14 05:42:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-14 05:42:45 +0100 |
commit | b352e3d1cc51c450c0ba128cac011cab607eb887 (patch) | |
tree | f28e1eaa8ce45c27b413a22cc6ed54aea339f5ae /instrumentation/afl-llvm-common.cc | |
parent | 6030df2f563c8c5bf482217478375a6b7ea3b15a (diff) | |
parent | 8bc3fa1df286aac46a0a724f64e2e07010d2497e (diff) | |
download | afl++-b352e3d1cc51c450c0ba128cac011cab607eb887.tar.gz |
Merge pull request #1646 from devnexen/llvm_custom_unique_refactoring
LLVM cmplog factoring custom Instruction iterator with added restriction
Diffstat (limited to 'instrumentation/afl-llvm-common.cc')
-rw-r--r-- | instrumentation/afl-llvm-common.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/instrumentation/afl-llvm-common.cc b/instrumentation/afl-llvm-common.cc index dc34d191..b50269fe 100644 --- a/instrumentation/afl-llvm-common.cc +++ b/instrumentation/afl-llvm-common.cc @@ -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 // location IDs would be assigned randomly (like normal afl/afl++). // This uses the "balls in bins" algorithm. |