[compiler-rt] r311831 - Revert "[libFuzzer] Use custom allocators for STL containers in libFuzzer"
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 29 16:35:14 PDT 2017
George Karpenkov via llvm-commits <llvm-commits at lists.llvm.org> writes:
> Author: george.karpenkov
> Date: Sat Aug 26 10:50:35 2017
> New Revision: 311831
>
> URL: http://llvm.org/viewvc/llvm-project?rev=311831&view=rev
> Log:
> Revert "[libFuzzer] Use custom allocators for STL containers in libFuzzer"
>
> This reverts commit 3539efc2f2218dba2bcbd645d0fe276f2b5cf588.
In the future, please refer to the SVN revision number when reverting,
and include a brief explanation of why the revert is happening (bot
failure, accidental commit, etc). This makes it easier to figure out
what's going on if/when someone is looking at the version control
history later.
> Modified:
> compiler-rt/trunk/lib/fuzzer/FuzzerCorpus.h
> compiler-rt/trunk/lib/fuzzer/FuzzerDefs.h
> compiler-rt/trunk/lib/fuzzer/FuzzerDictionary.h
> compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp
> compiler-rt/trunk/lib/fuzzer/FuzzerIO.cpp
> compiler-rt/trunk/lib/fuzzer/FuzzerIO.h
> compiler-rt/trunk/lib/fuzzer/FuzzerIOPosix.cpp
> compiler-rt/trunk/lib/fuzzer/FuzzerIOWindows.cpp
> compiler-rt/trunk/lib/fuzzer/FuzzerInternal.h
> compiler-rt/trunk/lib/fuzzer/FuzzerLoop.cpp
> compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp
> compiler-rt/trunk/lib/fuzzer/FuzzerMerge.h
> compiler-rt/trunk/lib/fuzzer/FuzzerMutate.cpp
> compiler-rt/trunk/lib/fuzzer/FuzzerMutate.h
> compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.cpp
> compiler-rt/trunk/lib/fuzzer/FuzzerUtil.cpp
> compiler-rt/trunk/lib/fuzzer/FuzzerUtil.h
> compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerCorpus.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerCorpus.h?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
>
> --- compiler-rt/trunk/lib/fuzzer/FuzzerCorpus.h (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerCorpus.h Sat Aug 26 10:50:35 2017
> @@ -35,7 +35,7 @@ struct InputInfo {
> size_t NumSuccessfullMutations = 0;
> bool MayDeleteFile = false;
> bool Reduced = false;
> - fuzzer::vector<uint32_t> UniqFeatureSet;
> + std::vector<uint32_t> UniqFeatureSet;
> };
>
> class InputCorpus {
> @@ -71,7 +71,7 @@ class InputCorpus {
> bool empty() const { return Inputs.empty(); }
> const Unit &operator[] (size_t Idx) const { return Inputs[Idx]->U; }
> void AddToCorpus(const Unit &U, size_t NumFeatures, bool MayDeleteFile,
> - const fuzzer::vector<uint32_t> &FeatureSet) {
> + const std::vector<uint32_t> &FeatureSet) {
> assert(!U.empty());
> if (FeatureDebug)
> Printf("ADD_TO_CORPUS %zd NF %zd\n", Inputs.size(), NumFeatures);
> @@ -100,7 +100,7 @@ class InputCorpus {
> }
>
> // Debug-only
> - void PrintFeatureSet(const fuzzer::vector<uint32_t> &FeatureSet) {
> + void PrintFeatureSet(const std::vector<uint32_t> &FeatureSet) {
> if (!FeatureDebug) return;
> Printf("{");
> for (uint32_t Feature: FeatureSet)
> @@ -256,11 +256,11 @@ private:
> }
> std::piecewise_constant_distribution<double> CorpusDistribution;
>
> - fuzzer::vector<double> Intervals;
> - fuzzer::vector<double> Weights;
> + std::vector<double> Intervals;
> + std::vector<double> Weights;
>
> std::unordered_set<std::string> Hashes;
> - fuzzer::vector<InputInfo*> Inputs;
> + std::vector<InputInfo*> Inputs;
>
> size_t NumAddedFeatures = 0;
> size_t NumUpdatedFeatures = 0;
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerDefs.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerDefs.h?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerDefs.h (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerDefs.h Sat Aug 26 10:50:35 2017
> @@ -18,8 +18,6 @@
> #include <cstring>
> #include <string>
> #include <vector>
> -#include <set>
> -#include <memory>
>
> // Platform detection.
> #ifdef __linux__
> @@ -104,19 +102,8 @@ struct ExternalFunctions;
> // Global interface to functions that may or may not be available.
> extern ExternalFunctions *EF;
>
> -// We are using a custom allocator to give a different symbol name to STL
> -// containers in order to avoid ODR violations.
> -template<typename T>
> -class fuzzer_allocator: public std::allocator<T> {};
> -
> -template<typename T>
> -using vector = std::vector<T, fuzzer_allocator<T>>;
> -
> -template<typename T>
> -using set = std::set<T, std::less<T>, fuzzer_allocator<T>>;
> -
> -typedef fuzzer::vector<uint8_t> Unit;
> -typedef fuzzer::vector<Unit> UnitVector;
> +typedef std::vector<uint8_t> Unit;
> +typedef std::vector<Unit> UnitVector;
> typedef int (*UserCallback)(const uint8_t *Data, size_t Size);
>
> int FuzzerDriver(int *argc, char ***argv, UserCallback Callback);
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerDictionary.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerDictionary.h?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerDictionary.h (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerDictionary.h Sat Aug 26 10:50:35 2017
> @@ -120,7 +120,7 @@ private:
> bool ParseOneDictionaryEntry(const std::string &Str, Unit *U);
> // Parses the dictionary file, fills Units, returns true iff all lines
> // were parsed succesfully.
> -bool ParseDictionaryFile(const std::string &Text, fuzzer::vector<Unit> *Units);
> +bool ParseDictionaryFile(const std::string &Text, std::vector<Unit> *Units);
>
> } // namespace fuzzer
>
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp Sat Aug 26 10:50:35 2017
> @@ -74,7 +74,7 @@ static const FlagDescription FlagDescrip
> static const size_t kNumFlags =
> sizeof(FlagDescriptions) / sizeof(FlagDescriptions[0]);
>
> -static fuzzer::vector<std::string> *Inputs;
> +static std::vector<std::string> *Inputs;
> static std::string *ProgName;
>
> static void PrintHelp() {
> @@ -175,7 +175,7 @@ static bool ParseOneFlag(const char *Par
> }
>
> // We don't use any library to minimize dependencies.
> -static void ParseFlags(const fuzzer::vector<std::string> &Args) {
> +static void ParseFlags(const std::vector<std::string> &Args) {
> for (size_t F = 0; F < kNumFlags; F++) {
> if (FlagDescriptions[F].IntFlag)
> *FlagDescriptions[F].IntFlag = FlagDescriptions[F].Default;
> @@ -185,7 +185,7 @@ static void ParseFlags(const fuzzer::vec
> if (FlagDescriptions[F].StrFlag)
> *FlagDescriptions[F].StrFlag = nullptr;
> }
> - Inputs = new fuzzer::vector<std::string>;
> + Inputs = new std::vector<std::string>;
> for (size_t A = 1; A < Args.size(); A++) {
> if (ParseOneFlag(Args[A].c_str())) {
> if (Flags.ignore_remaining_args)
> @@ -225,7 +225,7 @@ static void WorkerThread(const std::stri
> }
> }
>
> -std::string CloneArgsWithoutX(const fuzzer::vector<std::string> &Args,
> +std::string CloneArgsWithoutX(const std::vector<std::string> &Args,
> const char *X1, const char *X2) {
> std::string Cmd;
> for (auto &S : Args) {
> @@ -236,12 +236,12 @@ std::string CloneArgsWithoutX(const fuzz
> return Cmd;
> }
>
> -static int RunInMultipleProcesses(const fuzzer::vector<std::string> &Args,
> +static int RunInMultipleProcesses(const std::vector<std::string> &Args,
> unsigned NumWorkers, unsigned NumJobs) {
> std::atomic<unsigned> Counter(0);
> std::atomic<bool> HasErrors(false);
> std::string Cmd = CloneArgsWithoutX(Args, "jobs", "workers");
> - fuzzer::vector<std::thread> V;
> + std::vector<std::thread> V;
> std::thread Pulse(PulseThread);
> Pulse.detach();
> for (unsigned i = 0; i < NumWorkers; i++)
> @@ -294,7 +294,7 @@ static std::string GetDedupTokenFromFile
> return S.substr(Beg, End - Beg);
> }
>
> -int CleanseCrashInput(const fuzzer::vector<std::string> &Args,
> +int CleanseCrashInput(const std::vector<std::string> &Args,
> const FuzzingOptions &Options) {
> if (Inputs->size() != 1 || !Flags.exact_artifact_path) {
> Printf("ERROR: -cleanse_crash should be given one input file and"
> @@ -322,7 +322,7 @@ int CleanseCrashInput(const fuzzer::vect
> auto U = FileToVector(CurrentFilePath);
> size_t Size = U.size();
>
> - const fuzzer::vector<uint8_t> ReplacementBytes = {' ', 0xff};
> + const std::vector<uint8_t> ReplacementBytes = {' ', 0xff};
> for (int NumAttempts = 0; NumAttempts < 5; NumAttempts++) {
> bool Changed = false;
> for (size_t Idx = 0; Idx < Size; Idx++) {
> @@ -354,7 +354,7 @@ int CleanseCrashInput(const fuzzer::vect
> return 0;
> }
>
> -int MinimizeCrashInput(const fuzzer::vector<std::string> &Args,
> +int MinimizeCrashInput(const std::vector<std::string> &Args,
> const FuzzingOptions &Options) {
> if (Inputs->size() != 1) {
> Printf("ERROR: -minimize_crash should be given one input file\n");
> @@ -456,17 +456,17 @@ int MinimizeCrashInputInternalStep(Fuzze
> return 0;
> }
>
> -int AnalyzeDictionary(Fuzzer *F, const fuzzer::vector<Unit>& Dict,
> +int AnalyzeDictionary(Fuzzer *F, const std::vector<Unit>& Dict,
> UnitVector& Corpus) {
> Printf("Started dictionary minimization (up to %d tests)\n",
> Dict.size() * Corpus.size() * 2);
>
> // Scores and usage count for each dictionary unit.
> - fuzzer::vector<int> Scores(Dict.size());
> - fuzzer::vector<int> Usages(Dict.size());
> + std::vector<int> Scores(Dict.size());
> + std::vector<int> Usages(Dict.size());
>
> - fuzzer::vector<size_t> InitialFeatures;
> - fuzzer::vector<size_t> ModifiedFeatures;
> + std::vector<size_t> InitialFeatures;
> + std::vector<size_t> ModifiedFeatures;
> for (auto &C : Corpus) {
> // Get coverage for the testcase without modifications.
> F->ExecuteCallback(C.data(), C.size());
> @@ -531,7 +531,7 @@ int FuzzerDriver(int *argc, char ***argv
> EF = new ExternalFunctions();
> if (EF->LLVMFuzzerInitialize)
> EF->LLVMFuzzerInitialize(argc, argv);
> - const fuzzer::vector<std::string> Args(*argv, *argv + *argc);
> + const std::vector<std::string> Args(*argv, *argv + *argc);
> assert(!Args.empty());
> ProgName = new std::string(Args[0]);
> if (Argv0 != *ProgName) {
> @@ -593,7 +593,7 @@ int FuzzerDriver(int *argc, char ***argv
> Options.ArtifactPrefix = Flags.artifact_prefix;
> if (Flags.exact_artifact_path)
> Options.ExactArtifactPath = Flags.exact_artifact_path;
> - fuzzer::vector<Unit> Dictionary;
> + std::vector<Unit> Dictionary;
> if (Flags.dict)
> if (!ParseDictionaryFile(FileToString(Flags.dict), &Dictionary))
> return 1;
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerIO.cpp
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerIO.cpp?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerIO.cpp (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerIO.cpp Sat Aug 26 10:50:35 2017
> @@ -68,10 +68,10 @@ void WriteToFile(const Unit &U, const st
> fclose(Out);
> }
>
> -void ReadDirToVectorOfUnits(const char *Path, fuzzer::vector<Unit> *V,
> +void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V,
> long *Epoch, size_t MaxSize, bool ExitOnError) {
> long E = Epoch ? *Epoch : 0;
> - fuzzer::vector<std::string> Files;
> + std::vector<std::string> Files;
> ListFilesInDirRecursive(Path, Epoch, &Files, /*TopDir*/true);
> size_t NumLoaded = 0;
> for (size_t i = 0; i < Files.size(); i++) {
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerIO.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerIO.h?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerIO.h (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerIO.h Sat Aug 26 10:50:35 2017
> @@ -27,7 +27,7 @@ void CopyFileToErr(const std::string &Pa
>
> void WriteToFile(const Unit &U, const std::string &Path);
>
> -void ReadDirToVectorOfUnits(const char *Path, fuzzer::vector<Unit> *V,
> +void ReadDirToVectorOfUnits(const char *Path, std::vector<Unit> *V,
> long *Epoch, size_t MaxSize, bool ExitOnError);
>
> // Returns "Dir/FileName" or equivalent for the current OS.
> @@ -55,7 +55,7 @@ void RawPrint(const char *Str);
> bool IsFile(const std::string &Path);
>
> void ListFilesInDirRecursive(const std::string &Dir, long *Epoch,
> - fuzzer::vector<std::string> *V, bool TopDir);
> + std::vector<std::string> *V, bool TopDir);
>
> char GetSeparator();
>
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerIOPosix.cpp
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerIOPosix.cpp?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerIOPosix.cpp (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerIOPosix.cpp Sat Aug 26 10:50:35 2017
> @@ -33,7 +33,7 @@ bool IsFile(const std::string &Path) {
> }
>
> void ListFilesInDirRecursive(const std::string &Dir, long *Epoch,
> - fuzzer::vector<std::string> *V, bool TopDir) {
> + std::vector<std::string> *V, bool TopDir) {
> auto E = GetEpoch(Dir);
> if (Epoch)
> if (E && *Epoch >= E) return;
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerIOWindows.cpp
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerIOWindows.cpp?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerIOWindows.cpp (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerIOWindows.cpp Sat Aug 26 10:50:35 2017
> @@ -73,7 +73,7 @@ bool IsFile(const std::string &Path) {
> }
>
> void ListFilesInDirRecursive(const std::string &Dir, long *Epoch,
> - fuzzer::vector<std::string> *V, bool TopDir) {
> + std::vector<std::string> *V, bool TopDir) {
> auto E = GetEpoch(Dir);
> if (Epoch)
> if (E && *Epoch >= E) return;
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerInternal.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerInternal.h?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerInternal.h (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerInternal.h Sat Aug 26 10:50:35 2017
> @@ -69,9 +69,9 @@ public:
> InputInfo *II = nullptr);
>
> // Merge Corpora[1:] into Corpora[0].
> - void Merge(const fuzzer::vector<std::string> &Corpora);
> - void CrashResistantMerge(const fuzzer::vector<std::string> &Args,
> - const fuzzer::vector<std::string> &Corpora,
> + void Merge(const std::vector<std::string> &Corpora);
> + void CrashResistantMerge(const std::vector<std::string> &Args,
> + const std::vector<std::string> &Corpora,
> const char *CoverageSummaryInputPathOrNull,
> const char *CoverageSummaryOutputPathOrNull);
> void CrashResistantMergeInternalStep(const std::string &ControlFilePath);
> @@ -139,7 +139,7 @@ private:
> size_t MaxMutationLen = 0;
> size_t TmpMaxMutationLen = 0;
>
> - fuzzer::vector<uint32_t> UniqFeatureSetTmp;
> + std::vector<uint32_t> UniqFeatureSetTmp;
>
> // Need to know our own thread.
> static thread_local bool IsMyThread;
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerLoop.cpp
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerLoop.cpp?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerLoop.cpp (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerLoop.cpp Sat Aug 26 10:50:35 2017
> @@ -350,7 +350,7 @@ void Fuzzer::CheckExitOnSrcPosOrItem() {
>
> void Fuzzer::RereadOutputCorpus(size_t MaxSize) {
> if (Options.OutputCorpus.empty() || !Options.ReloadIntervalSec) return;
> - fuzzer::vector<Unit> AdditionalCorpus;
> + std::vector<Unit> AdditionalCorpus;
> ReadDirToVectorOfUnits(Options.OutputCorpus.c_str(), &AdditionalCorpus,
> &EpochOfLastReadOfOutputCorpus, MaxSize,
> /*ExitOnError*/ false);
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerMerge.cpp Sat Aug 26 10:50:35 2017
> @@ -74,7 +74,7 @@ bool Merger::Parse(std::istream &IS, boo
> size_t ExpectedStartMarker = 0;
> const size_t kInvalidStartMarker = -1;
> size_t LastSeenStartMarker = kInvalidStartMarker;
> - fuzzer::vector<uint32_t> TmpFeatures;
> + std::vector<uint32_t> TmpFeatures;
> while (std::getline(IS, Line, '\n')) {
> std::istringstream ISS1(Line);
> std::string Marker;
> @@ -123,7 +123,7 @@ size_t Merger::ApproximateMemoryConsumpt
> // Decides which files need to be merged (add thost to NewFiles).
> // Returns the number of new features added.
> size_t Merger::Merge(const std::set<uint32_t> &InitialFeatures,
> - fuzzer::vector<std::string> *NewFiles) {
> + std::vector<std::string> *NewFiles) {
> NewFiles->clear();
> assert(NumFilesInFirstCorpus <= Files.size());
> std::set<uint32_t> AllFeatures(InitialFeatures);
> @@ -138,7 +138,7 @@ size_t Merger::Merge(const std::set<uint
> // Remove all features that we already know from all other inputs.
> for (size_t i = NumFilesInFirstCorpus; i < Files.size(); i++) {
> auto &Cur = Files[i].Features;
> - fuzzer::vector<uint32_t> Tmp;
> + std::vector<uint32_t> Tmp;
> std::set_difference(Cur.begin(), Cur.end(), AllFeatures.begin(),
> AllFeatures.end(), std::inserter(Tmp, Tmp.begin()));
> Cur.swap(Tmp);
> @@ -252,15 +252,15 @@ void Fuzzer::CrashResistantMergeInternal
> }
>
> // Outer process. Does not call the target code and thus sohuld not fail.
> -void Fuzzer::CrashResistantMerge(const fuzzer::vector<std::string> &Args,
> - const fuzzer::vector<std::string> &Corpora,
> +void Fuzzer::CrashResistantMerge(const std::vector<std::string> &Args,
> + const std::vector<std::string> &Corpora,
> const char *CoverageSummaryInputPathOrNull,
> const char *CoverageSummaryOutputPathOrNull) {
> if (Corpora.size() <= 1) {
> Printf("Merge requires two or more corpus dirs\n");
> return;
> }
> - fuzzer::vector<std::string> AllFiles;
> + std::vector<std::string> AllFiles;
> ListFilesInDirRecursive(Corpora[0], nullptr, &AllFiles, /*TopDir*/true);
> size_t NumFilesInFirstCorpus = AllFiles.size();
> for (size_t i = 1; i < Corpora.size(); i++)
> @@ -318,7 +318,7 @@ void Fuzzer::CrashResistantMerge(const f
> std::ofstream SummaryOut(CoverageSummaryOutputPathOrNull);
> M.PrintSummary(SummaryOut);
> }
> - fuzzer::vector<std::string> NewFiles;
> + std::vector<std::string> NewFiles;
> std::set<uint32_t> InitialFeatures;
> if (CoverageSummaryInputPathOrNull) {
> std::ifstream SummaryIn(CoverageSummaryInputPathOrNull);
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerMerge.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerMerge.h?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerMerge.h (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerMerge.h Sat Aug 26 10:50:35 2017
> @@ -52,11 +52,11 @@ namespace fuzzer {
> struct MergeFileInfo {
> std::string Name;
> size_t Size = 0;
> - fuzzer::vector<uint32_t> Features;
> + std::vector<uint32_t> Features;
> };
>
> struct Merger {
> - fuzzer::vector<MergeFileInfo> Files;
> + std::vector<MergeFileInfo> Files;
> size_t NumFilesInFirstCorpus = 0;
> size_t FirstNotProcessedFile = 0;
> std::string LastFailure;
> @@ -67,8 +67,8 @@ struct Merger {
> void PrintSummary(std::ostream &OS);
> std::set<uint32_t> ParseSummary(std::istream &IS);
> size_t Merge(const std::set<uint32_t> &InitialFeatures,
> - fuzzer::vector<std::string> *NewFiles);
> - size_t Merge(fuzzer::vector<std::string> *NewFiles) {
> + std::vector<std::string> *NewFiles);
> + size_t Merge(std::vector<std::string> *NewFiles) {
> return Merge(std::set<uint32_t>{}, NewFiles);
> }
> size_t ApproximateMemoryConsumption() const;
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerMutate.cpp
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerMutate.cpp?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerMutate.cpp (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerMutate.cpp Sat Aug 26 10:50:35 2017
> @@ -466,7 +466,7 @@ void MutationDispatcher::RecordSuccessfu
> }
>
> void MutationDispatcher::PrintRecommendedDictionary() {
> - fuzzer::vector<DictionaryEntry> V;
> + std::vector<DictionaryEntry> V;
> for (auto &DE : PersistentAutoDictionary)
> if (!ManualDictionary.ContainsWord(DE.GetW()))
> V.push_back(DE);
> @@ -506,7 +506,7 @@ size_t MutationDispatcher::DefaultMutate
> // Mutates Data in place, returns new size.
> size_t MutationDispatcher::MutateImpl(uint8_t *Data, size_t Size,
> size_t MaxSize,
> - const fuzzer::vector<Mutator> &Mutators) {
> + const std::vector<Mutator> &Mutators) {
> assert(MaxSize > 0);
> // Some mutations may fail (e.g. can't insert more bytes if Size == MaxSize),
> // in which case they will return 0.
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerMutate.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerMutate.h?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerMutate.h (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerMutate.h Sat Aug 26 10:50:35 2017
> @@ -96,7 +96,7 @@ private:
> size_t AddWordFromDictionary(Dictionary &D, uint8_t *Data, size_t Size,
> size_t MaxSize);
> size_t MutateImpl(uint8_t *Data, size_t Size, size_t MaxSize,
> - const fuzzer::vector<Mutator> &Mutators);
> + const std::vector<Mutator> &Mutators);
>
> size_t InsertPartOf(const uint8_t *From, size_t FromSize, uint8_t *To,
> size_t ToSize, size_t MaxToSize);
> @@ -128,21 +128,21 @@ private:
> // entries that led to successfull discoveries in the past mutations.
> Dictionary PersistentAutoDictionary;
>
> - fuzzer::vector<Mutator> CurrentMutatorSequence;
> - fuzzer::vector<DictionaryEntry *> CurrentDictionaryEntrySequence;
> + std::vector<Mutator> CurrentMutatorSequence;
> + std::vector<DictionaryEntry *> CurrentDictionaryEntrySequence;
>
> static const size_t kCmpDictionaryEntriesDequeSize = 16;
> DictionaryEntry CmpDictionaryEntriesDeque[kCmpDictionaryEntriesDequeSize];
> size_t CmpDictionaryEntriesDequeIdx = 0;
>
> const InputCorpus *Corpus = nullptr;
> - fuzzer::vector<uint8_t> MutateInPlaceHere;
> + std::vector<uint8_t> MutateInPlaceHere;
> // CustomCrossOver needs its own buffer as a custom implementation may call
> // LLVMFuzzerMutate, which in turn may resize MutateInPlaceHere.
> - fuzzer::vector<uint8_t> CustomCrossOverInPlaceHere;
> + std::vector<uint8_t> CustomCrossOverInPlaceHere;
>
> - fuzzer::vector<Mutator> Mutators;
> - fuzzer::vector<Mutator> DefaultMutators;
> + std::vector<Mutator> Mutators;
> + std::vector<Mutator> DefaultMutators;
> };
>
> } // namespace fuzzer
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.cpp
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.cpp?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.cpp (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerTracePC.cpp Sat Aug 26 10:50:35 2017
> @@ -270,7 +270,7 @@ void TracePC::PrintCoverage() {
>
> void TracePC::DumpCoverage() {
> if (EF->__sanitizer_dump_coverage) {
> - fuzzer::vector<uintptr_t> PCsCopy(GetNumPCs());
> + std::vector<uintptr_t> PCsCopy(GetNumPCs());
> for (size_t i = 0; i < GetNumPCs(); i++)
> PCsCopy[i] = PCs()[i] ? GetPreviousInstructionPc(PCs()[i]) : 0;
> EF->__sanitizer_dump_coverage(PCsCopy.data(), PCsCopy.size());
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerUtil.cpp
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerUtil.cpp?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerUtil.cpp (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerUtil.cpp Sat Aug 26 10:50:35 2017
> @@ -124,7 +124,7 @@ bool ParseOneDictionaryEntry(const std::
> return true;
> }
>
> -bool ParseDictionaryFile(const std::string &Text, fuzzer::vector<Unit> *Units) {
> +bool ParseDictionaryFile(const std::string &Text, std::vector<Unit> *Units) {
> if (Text.empty()) {
> Printf("ParseDictionaryFile: file does not exist or is empty\n");
> return false;
>
> Modified: compiler-rt/trunk/lib/fuzzer/FuzzerUtil.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerUtil.h?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/FuzzerUtil.h (original)
> +++ compiler-rt/trunk/lib/fuzzer/FuzzerUtil.h Sat Aug 26 10:50:35 2017
> @@ -57,10 +57,10 @@ FILE *OpenProcessPipe(const char *Comman
> const void *SearchMemory(const void *haystack, size_t haystacklen,
> const void *needle, size_t needlelen);
>
> -std::string CloneArgsWithoutX(const fuzzer::vector<std::string> &Args,
> +std::string CloneArgsWithoutX(const std::vector<std::string> &Args,
> const char *X1, const char *X2);
>
> -inline std::string CloneArgsWithoutX(const fuzzer::vector<std::string> &Args,
> +inline std::string CloneArgsWithoutX(const std::vector<std::string> &Args,
> const char *X) {
> return CloneArgsWithoutX(Args, X, X);
> }
>
> Modified: compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp?rev=311831&r1=311830&r2=311831&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp (original)
> +++ compiler-rt/trunk/lib/fuzzer/tests/FuzzerUnittest.cpp Sat Aug 26 10:50:35 2017
> @@ -526,7 +526,7 @@ TEST(FuzzerDictionary, ParseOneDictionar
> }
>
> TEST(FuzzerDictionary, ParseDictionaryFile) {
> - fuzzer::vector<Unit> Units;
> + std::vector<Unit> Units;
> EXPECT_FALSE(ParseDictionaryFile("zzz\n", &Units));
> EXPECT_FALSE(ParseDictionaryFile("", &Units));
> EXPECT_TRUE(ParseDictionaryFile("\n", &Units));
> @@ -538,11 +538,11 @@ TEST(FuzzerDictionary, ParseDictionaryFi
> EXPECT_TRUE(ParseDictionaryFile(" #zzzz\n", &Units));
> EXPECT_EQ(Units.size(), 0U);
> EXPECT_TRUE(ParseDictionaryFile(" #zzzz\naaa=\"aa\"", &Units));
> - EXPECT_EQ(Units, fuzzer::vector<Unit>({Unit({'a', 'a'})}));
> + EXPECT_EQ(Units, std::vector<Unit>({Unit({'a', 'a'})}));
> EXPECT_TRUE(
> ParseDictionaryFile(" #zzzz\naaa=\"aa\"\n\nabc=\"abc\"", &Units));
> EXPECT_EQ(Units,
> - fuzzer::vector<Unit>({Unit({'a', 'a'}), Unit({'a', 'b', 'c'})}));
> + std::vector<Unit>({Unit({'a', 'a'}), Unit({'a', 'b', 'c'})}));
> }
>
> TEST(FuzzerUtil, Base64) {
> @@ -566,7 +566,7 @@ TEST(Corpus, Distribution) {
> for (size_t i = 0; i < N; i++)
> C->AddToCorpus(Unit{ static_cast<uint8_t>(i) }, 1, false, {});
>
> - fuzzer::vector<size_t> Hist(N);
> + std::vector<size_t> Hist(N);
> for (size_t i = 0; i < N * TriesPerUnit; i++) {
> Hist[C->ChooseUnitIdxToMutate(Rand)]++;
> }
> @@ -596,21 +596,21 @@ TEST(Merge, Bad) {
> }
> }
>
> -void EQ(const fuzzer::vector<uint32_t> &A, const fuzzer::vector<uint32_t> &B) {
> +void EQ(const std::vector<uint32_t> &A, const std::vector<uint32_t> &B) {
> EXPECT_EQ(A, B);
> }
>
> -void EQ(const fuzzer::vector<std::string> &A, const fuzzer::vector<std::string> &B) {
> +void EQ(const std::vector<std::string> &A, const std::vector<std::string> &B) {
> std::set<std::string> a(A.begin(), A.end());
> std::set<std::string> b(B.begin(), B.end());
> EXPECT_EQ(a, b);
> }
>
> static void Merge(const std::string &Input,
> - const fuzzer::vector<std::string> Result,
> + const std::vector<std::string> Result,
> size_t NumNewFeatures) {
> Merger M;
> - fuzzer::vector<std::string> NewFiles;
> + std::vector<std::string> NewFiles;
> EXPECT_TRUE(M.Parse(Input, true));
> std::stringstream SS;
> M.PrintSummary(SS);
> @@ -658,7 +658,7 @@ TEST(Merge, Good) {
> EQ(M.Files[1].Features, {4, 5, 6});
>
>
> - fuzzer::vector<std::string> NewFiles;
> + std::vector<std::string> NewFiles;
>
> EXPECT_TRUE(M.Parse("3\n2\nAA\nBB\nC\n"
> "STARTED 0 1000\nDONE 0 1 2 3\n"
> @@ -739,7 +739,7 @@ TEST(Fuzzer, ForEachNonZeroByte) {
> 0, 0, 0, 0, 0, 0, 0, 8,
> 9, 9, 9, 9, 9, 9, 9, 9,
> };
> - typedef fuzzer::vector<std::pair<size_t, uint8_t> > Vec;
> + typedef std::vector<std::pair<size_t, uint8_t> > Vec;
> Vec Res, Expected;
> auto CB = [&](size_t FirstFeature, size_t Idx, uint8_t V) {
> Res.push_back({FirstFeature + Idx, V});
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list