[lld] r228376 - [Core] Remove roundTripPass() function.

Shankar Easwaran shankare at codeaurora.org
Thu Feb 5 20:15:03 PST 2015


Author: shankare
Date: Thu Feb  5 22:15:02 2015
New Revision: 228376

URL: http://llvm.org/viewvc/llvm-project?rev=228376&view=rev
Log:
[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.

Modified:
    lld/trunk/include/lld/Core/LinkingContext.h
    lld/trunk/lib/Core/LinkingContext.cpp
    lld/trunk/lib/Driver/Driver.cpp

Modified: lld/trunk/include/lld/Core/LinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/LinkingContext.h?rev=228376&r1=228375&r2=228376&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/LinkingContext.h (original)
+++ lld/trunk/include/lld/Core/LinkingContext.h Thu Feb  5 22:15:02 2015
@@ -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;

Modified: lld/trunk/lib/Core/LinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/LinkingContext.cpp?rev=228376&r1=228375&r2=228376&view=diff
==============================================================================
--- lld/trunk/lib/Core/LinkingContext.cpp (original)
+++ lld/trunk/lib/Core/LinkingContext.cpp Thu Feb  5 22:15:02 2015
@@ -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() {}
 

Modified: lld/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=228376&r1=228375&r2=228376&view=diff
==============================================================================
--- lld/trunk/lib/Driver/Driver.cpp (original)
+++ lld/trunk/lib/Driver/Driver.cpp Thu Feb  5 22:15:02 2015
@@ -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 &contex
   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)));
   }





More information about the llvm-commits mailing list