<div dir="ltr">Nice cleanup. I'm surprised we had two constructors for LinkingContext class, one for outside NDEBUG and one for inside NDEBUG.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 5, 2015 at 8:15 PM, Shankar Easwaran <span dir="ltr"><<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: shankare<br>
Date: Thu Feb  5 22:15:02 2015<br>
New Revision: 228376<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=228376&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=228376&view=rev</a><br>
Log:<br>
[Core] Remove roundTripPass() function.<br>
<br>
Use the environment variable "LLD_RUN_ROUNDTRIP_TEST" in the test that you want<br>
to disable, as<br>
<br>
RUN: env LLD_RUN_ROUNDTRIP_TEST= <run><br>
<br>
This was a patch that I made, but I find this a better way to accomplish what we<br>
want to do.<br>
<br>
Modified:<br>
    lld/trunk/include/lld/Core/LinkingContext.h<br>
    lld/trunk/lib/Core/LinkingContext.cpp<br>
    lld/trunk/lib/Driver/Driver.cpp<br>
<br>
Modified: lld/trunk/include/lld/Core/LinkingContext.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/LinkingContext.h?rev=228376&r1=228375&r2=228376&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/LinkingContext.h?rev=228376&r1=228375&r2=228376&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/include/lld/Core/LinkingContext.h (original)<br>
+++ lld/trunk/include/lld/Core/LinkingContext.h Thu Feb  5 22:15:02 2015<br>
@@ -316,10 +316,6 @@ public:<br>
   /// Return the next ordinal and Increment it.<br>
   virtual uint64_t getNextOrdinalAndIncrement() const { return _nextOrdinal++; }<br>
<br>
-#ifndef NDEBUG<br>
-  bool runRoundTripPass() const { return _runRoundTripPasses; }<br>
-#endif<br>
-<br>
   // This function is called just before the Resolver kicks in.<br>
   // Derived classes may use that chance to rearrange the input files.<br>
   virtual void maybeSortInputFiles() {}<br>
@@ -357,9 +353,6 @@ protected:<br>
   bool _allowRemainingUndefines;<br>
   bool _logInputFiles;<br>
   bool _allowShlibUndefines;<br>
-#ifndef NDEBUG<br>
-  bool _runRoundTripPasses;<br>
-#endif<br>
   OutputFileType _outputFileType;<br>
   std::vector<StringRef> _deadStripRoots;<br>
   std::map<std::string, std::string> _aliasSymbols;<br>
<br>
Modified: lld/trunk/lib/Core/LinkingContext.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/LinkingContext.cpp?rev=228376&r1=228375&r2=228376&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/LinkingContext.cpp?rev=228376&r1=228375&r2=228376&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/Core/LinkingContext.cpp (original)<br>
+++ lld/trunk/lib/Core/LinkingContext.cpp Thu Feb  5 22:15:02 2015<br>
@@ -13,28 +13,9 @@<br>
 #include "lld/Core/Simple.h"<br>
 #include "lld/Core/Writer.h"<br>
 #include "llvm/ADT/Triple.h"<br>
-#include "llvm/Support/Process.h"<br>
<br>
 namespace lld {<br>
<br>
-#ifndef NDEBUG<br>
-LinkingContext::LinkingContext()<br>
-    : _deadStrip(false), _allowDuplicates(false),<br>
-      _globalsAreDeadStripRoots(false),<br>
-      _searchArchivesToOverrideTentativeDefinitions(false),<br>
-      _searchSharedLibrariesToOverrideTentativeDefinitions(false),<br>
-      _warnIfCoalesableAtomsHaveDifferentCanBeNull(false),<br>
-      _warnIfCoalesableAtomsHaveDifferentLoadName(false),<br>
-      _printRemainingUndefines(true), _allowRemainingUndefines(false),<br>
-      _logInputFiles(false), _allowShlibUndefines(false),<br>
-      _runRoundTripPasses(false), _outputFileType(OutputFileType::Default),<br>
-      _nextOrdinal(0) {<br>
-  llvm::Optional<std::string> env =<br>
-      llvm::sys::Process::GetEnv("LLD_RUN_ROUNDTRIP_TEST");<br>
-  if (env.hasValue() && !env.getValue().empty())<br>
-    _runRoundTripPasses = true;<br>
-}<br>
-#else<br>
 LinkingContext::LinkingContext()<br>
     : _deadStrip(false), _allowDuplicates(false),<br>
       _globalsAreDeadStripRoots(false),<br>
@@ -45,7 +26,6 @@ LinkingContext::LinkingContext()<br>
       _printRemainingUndefines(true), _allowRemainingUndefines(false),<br>
       _logInputFiles(false), _allowShlibUndefines(false),<br>
       _outputFileType(OutputFileType::Default), _nextOrdinal(0) {}<br>
-#endif<br>
<br>
 LinkingContext::~LinkingContext() {}<br>
<br>
<br>
Modified: lld/trunk/lib/Driver/Driver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=228376&r1=228375&r2=228376&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=228376&r1=228375&r2=228376&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/Driver/Driver.cpp (original)<br>
+++ lld/trunk/lib/Driver/Driver.cpp Thu Feb  5 22:15:02 2015<br>
@@ -25,6 +25,7 @@<br>
 #include "llvm/Support/CommandLine.h"<br>
 #include "llvm/Support/FileSystem.h"<br>
 #include "llvm/Support/Path.h"<br>
+#include "llvm/Support/Process.h"<br>
 #include "llvm/Support/raw_ostream.h"<br>
 #include <mutex><br>
<br>
@@ -117,7 +118,10 @@ bool Driver::link(LinkingContext &contex<br>
   context.addPasses(pm);<br>
<br>
 #ifndef NDEBUG<br>
-  if (context.runRoundTripPass()) {<br>
+  llvm::Optional<std::string> env =<br>
+      llvm::sys::Process::GetEnv("LLD_RUN_ROUNDTRIP_TEST");<br>
+<br>
+  if (env.hasValue() && !env.getValue().empty()) {<br>
     pm.add(std::unique_ptr<Pass>(new RoundTripYAMLPass(context)));<br>
     pm.add(std::unique_ptr<Pass>(new RoundTripNativePass(context)));<br>
   }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>