From 8f1b2d09309e7fdb0e4e53262c2af24f7fb3b733 Mon Sep 17 00:00:00 2001 From: Shankar Easwaran Date: Fri, 6 Feb 2015 04:15:02 +0000 Subject: [PATCH] [Core] Remove roundTripPass() function. Use the environment variable "LLD_RUN_ROUNDTRIP_TEST" in the test that you want to disable, as RUN: env LLD_RUN_ROUNDTRIP_TEST= This was a patch that I made, but I find this a better way to accomplish what we want to do. llvm-svn: 228376 --- lld/include/lld/Core/LinkingContext.h | 7 ------- lld/lib/Core/LinkingContext.cpp | 20 -------------------- lld/lib/Driver/Driver.cpp | 6 +++++- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/lld/include/lld/Core/LinkingContext.h b/lld/include/lld/Core/LinkingContext.h index ce7cf66641a3..15b8ceba8fd8 100644 --- a/lld/include/lld/Core/LinkingContext.h +++ b/lld/include/lld/Core/LinkingContext.h @@ -316,10 +316,6 @@ public: /// Return the next ordinal and Increment it. virtual uint64_t getNextOrdinalAndIncrement() const { return _nextOrdinal++; } -#ifndef NDEBUG - bool runRoundTripPass() const { return _runRoundTripPasses; } -#endif - // This function is called just before the Resolver kicks in. // Derived classes may use that chance to rearrange the input files. virtual void maybeSortInputFiles() {} @@ -357,9 +353,6 @@ protected: bool _allowRemainingUndefines; bool _logInputFiles; bool _allowShlibUndefines; -#ifndef NDEBUG - bool _runRoundTripPasses; -#endif OutputFileType _outputFileType; std::vector _deadStripRoots; std::map _aliasSymbols; diff --git a/lld/lib/Core/LinkingContext.cpp b/lld/lib/Core/LinkingContext.cpp index 4b63852cc72c..c6656b935916 100644 --- a/lld/lib/Core/LinkingContext.cpp +++ b/lld/lib/Core/LinkingContext.cpp @@ -13,28 +13,9 @@ #include "lld/Core/Simple.h" #include "lld/Core/Writer.h" #include "llvm/ADT/Triple.h" -#include "llvm/Support/Process.h" namespace lld { -#ifndef NDEBUG -LinkingContext::LinkingContext() - : _deadStrip(false), _allowDuplicates(false), - _globalsAreDeadStripRoots(false), - _searchArchivesToOverrideTentativeDefinitions(false), - _searchSharedLibrariesToOverrideTentativeDefinitions(false), - _warnIfCoalesableAtomsHaveDifferentCanBeNull(false), - _warnIfCoalesableAtomsHaveDifferentLoadName(false), - _printRemainingUndefines(true), _allowRemainingUndefines(false), - _logInputFiles(false), _allowShlibUndefines(false), - _runRoundTripPasses(false), _outputFileType(OutputFileType::Default), - _nextOrdinal(0) { - llvm::Optional env = - llvm::sys::Process::GetEnv("LLD_RUN_ROUNDTRIP_TEST"); - if (env.hasValue() && !env.getValue().empty()) - _runRoundTripPasses = true; -} -#else LinkingContext::LinkingContext() : _deadStrip(false), _allowDuplicates(false), _globalsAreDeadStripRoots(false), @@ -45,7 +26,6 @@ LinkingContext::LinkingContext() _printRemainingUndefines(true), _allowRemainingUndefines(false), _logInputFiles(false), _allowShlibUndefines(false), _outputFileType(OutputFileType::Default), _nextOrdinal(0) {} -#endif LinkingContext::~LinkingContext() {} diff --git a/lld/lib/Driver/Driver.cpp b/lld/lib/Driver/Driver.cpp index 137caee805cd..3593d8c426aa 100644 --- a/lld/lib/Driver/Driver.cpp +++ b/lld/lib/Driver/Driver.cpp @@ -25,6 +25,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" +#include "llvm/Support/Process.h" #include "llvm/Support/raw_ostream.h" #include @@ -117,7 +118,10 @@ bool Driver::link(LinkingContext &context, raw_ostream &diagnostics) { context.addPasses(pm); #ifndef NDEBUG - if (context.runRoundTripPass()) { + llvm::Optional env = + llvm::sys::Process::GetEnv("LLD_RUN_ROUNDTRIP_TEST"); + + if (env.hasValue() && !env.getValue().empty()) { pm.add(std::unique_ptr(new RoundTripYAMLPass(context))); pm.add(std::unique_ptr(new RoundTripNativePass(context))); }