[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= <run>

This was a patch that I made, but I find this a better way to accomplish what we
want to do.

llvm-svn: 228376
This commit is contained in:
Shankar Easwaran 2015-02-06 04:15:02 +00:00
parent e315edd747
commit 8f1b2d0930
3 changed files with 5 additions and 28 deletions

View File

@ -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<StringRef> _deadStripRoots;
std::map<std::string, std::string> _aliasSymbols;

View File

@ -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<std::string> 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() {}

View File

@ -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 <mutex>
@ -117,7 +118,10 @@ bool Driver::link(LinkingContext &context, raw_ostream &diagnostics) {
context.addPasses(pm);
#ifndef NDEBUG
if (context.runRoundTripPass()) {
llvm::Optional<std::string> env =
llvm::sys::Process::GetEnv("LLD_RUN_ROUNDTRIP_TEST");
if (env.hasValue() && !env.getValue().empty()) {
pm.add(std::unique_ptr<Pass>(new RoundTripYAMLPass(context)));
pm.add(std::unique_ptr<Pass>(new RoundTripNativePass(context)));
}