From a58d0af058038595c93de961b725f86997cf8d4a Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 8 Apr 2022 18:37:26 -0700 Subject: Revert D121556 "[randstruct] Add randomize structure layout support" This reverts commit 3f0587d0c668202bb89d29a25432aa290e551a31. Not all tests pass after a few rounds of fixes. I spot one failure that std::shuffle (potentially different results with different STL implementations) was misused and replaced it with llvm::shuffle, but there appears to be another failure in a Windows build. The latest failure is reported on https://reviews.llvm.org/D121556#3440383 --- clang/lib/Frontend/CompilerInvocation.cpp | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 5181999..83de27b 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -94,7 +94,6 @@ #include #include #include -#include #include #include #include @@ -3686,9 +3685,6 @@ void CompilerInvocation::GenerateLangArgs(const LangOptions &Opts, for (const auto &MP : Opts.MacroPrefixMap) GenerateArg(Args, OPT_fmacro_prefix_map_EQ, MP.first + "=" + MP.second, SA); - - if (!Opts.RandstructSeed.empty()) - GenerateArg(Args, OPT_frandomize_layout_seed_EQ, Opts.RandstructSeed, SA); } bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args, @@ -4241,19 +4237,6 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args, Diags.Report(diag::err_cc1_unbounded_vscale_min); } - if (const Arg *A = Args.getLastArg(OPT_frandomize_layout_seed_file_EQ)) { - std::ifstream SeedFile(A->getValue(0)); - - if (!SeedFile.is_open()) - Diags.Report(diag::err_drv_cannot_open_randomize_layout_seed_file) - << A->getValue(0); - - std::getline(SeedFile, Opts.RandstructSeed); - } - - if (const Arg *A = Args.getLastArg(OPT_frandomize_layout_seed_EQ)) - Opts.RandstructSeed = A->getValue(0); - return Diags.getNumErrors() == NumErrorsBefore; } -- cgit v1.1