[llvm] r199929 - Replace the interim lli build fix with something cleaner

Alp Toker alp at nuanti.com
Thu Jan 23 11:57:16 PST 2014


Author: alp
Date: Thu Jan 23 13:57:16 2014
New Revision: 199929

URL: http://llvm.org/viewvc/llvm-project?rev=199929&view=rev
Log:
Replace the interim lli build fix with something cleaner

Eliminates the LLI_BUILDING_CHILD build hack from r199885.

Also add a FIXME to remove code that tricks the tests into passing when the
feature fails to work. Please don't do stuff like this, the tests exist for a
reason!

Modified:
    llvm/trunk/tools/lli/ChildTarget/CMakeLists.txt
    llvm/trunk/tools/lli/ChildTarget/Makefile
    llvm/trunk/tools/lli/RemoteTarget.cpp
    llvm/trunk/tools/lli/RemoteTarget.h
    llvm/trunk/tools/lli/lli.cpp

Modified: llvm/trunk/tools/lli/ChildTarget/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/ChildTarget/CMakeLists.txt?rev=199929&r1=199928&r2=199929&view=diff
==============================================================================
--- llvm/trunk/tools/lli/ChildTarget/CMakeLists.txt (original)
+++ llvm/trunk/tools/lli/ChildTarget/CMakeLists.txt Thu Jan 23 13:57:16 2014
@@ -1,5 +1,4 @@
 set(LLVM_LINK_COMPONENTS support)
-add_definitions(-DLLI_BUILDING_CHILD)
 
 add_llvm_executable(lli-child-target
   ChildTarget.cpp

Modified: llvm/trunk/tools/lli/ChildTarget/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/ChildTarget/Makefile?rev=199929&r1=199928&r2=199929&view=diff
==============================================================================
--- llvm/trunk/tools/lli/ChildTarget/Makefile (original)
+++ llvm/trunk/tools/lli/ChildTarget/Makefile Thu Jan 23 13:57:16 2014
@@ -14,8 +14,6 @@ include $(LEVEL)/Makefile.config
 
 LINK_COMPONENTS := support
 
-CXXFLAGS += -DLLI_BUILDING_CHILD
-
 SOURCES := ChildTarget.cpp ../RemoteTarget.cpp
 
 include $(LLVM_SRC_ROOT)/Makefile.rules

Modified: llvm/trunk/tools/lli/RemoteTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/RemoteTarget.cpp?rev=199929&r1=199928&r2=199929&view=diff
==============================================================================
--- llvm/trunk/tools/lli/RemoteTarget.cpp (original)
+++ llvm/trunk/tools/lli/RemoteTarget.cpp Thu Jan 23 13:57:16 2014
@@ -22,31 +22,6 @@
 
 using namespace llvm;
 
-#ifndef LLI_BUILDING_CHILD
-
-// Static methods
-RemoteTarget *RemoteTarget::createRemoteTarget() {
-  return new RemoteTarget;
-}
-
-RemoteTarget *RemoteTarget::createExternalRemoteTarget(std::string &ChildName) {
-#ifdef LLVM_ON_UNIX
-  return new RemoteTargetExternal(ChildName);
-#else
-  return 0;
-#endif
-}
-
-bool RemoteTarget::hostSupportsExternalRemoteTarget() {
-#ifdef LLVM_ON_UNIX
-  return true;
-#else
-  return false;
-#endif
-}
-
-#endif
-
 ////////////////////////////////////////////////////////////////////////////////
 // Simulated remote execution
 //

Modified: llvm/trunk/tools/lli/RemoteTarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/RemoteTarget.h?rev=199929&r1=199928&r2=199929&view=diff
==============================================================================
--- llvm/trunk/tools/lli/RemoteTarget.h (original)
+++ llvm/trunk/tools/lli/RemoteTarget.h Thu Jan 23 13:57:16 2014
@@ -111,11 +111,6 @@ public:
 
   RemoteTarget() : IsRunning(false), ErrorMsg("") {}
   virtual ~RemoteTarget() { if (IsRunning) stop(); }
-
-  // Create an instance of the system-specific remote target class.
-  static RemoteTarget *createRemoteTarget();
-  static RemoteTarget *createExternalRemoteTarget(std::string &ChildName);
-  static bool hostSupportsExternalRemoteTarget(); 
 private:
   // Main processing function for the remote target process. Command messages
   // are received on file descriptor CmdFD and responses come back on OutFD.

Modified: llvm/trunk/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=199929&r1=199928&r2=199929&view=diff
==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Thu Jan 23 13:57:16 2014
@@ -17,6 +17,7 @@
 #include "llvm/IR/LLVMContext.h"
 #include "RemoteMemoryManager.h"
 #include "RemoteTarget.h"
+#include "RemoteTargetExternal.h"
 #include "llvm/ADT/Triple.h"
 #include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/CodeGen/LinkAllCodegenComponents.h"
@@ -663,21 +664,23 @@ int main(int argc, char **argv, char * c
 
     OwningPtr<RemoteTarget> Target;
     if (!ChildExecPath.empty()) { // Remote execution on a child process
-      if (!RemoteTarget::hostSupportsExternalRemoteTarget()) {
-        errs() << "Warning: host does not support external remote targets.\n"
-               << "  Defaulting to simulated remote execution\n";
-        Target.reset(RemoteTarget::createRemoteTarget());
-      } else {
-        if (!sys::fs::can_execute(ChildExecPath)) {
-          errs() << "Unable to find usable child executable: '" << ChildExecPath
-                 << "'\n";
-          return -1;
-        }
-        Target.reset(RemoteTarget::createExternalRemoteTarget(ChildExecPath));
+#ifndef LLVM_ON_UNIX
+      // FIXME: Remove this pointless fallback mode which causes tests to "pass"
+      // on platforms where they should XFAIL.
+      errs() << "Warning: host does not support external remote targets.\n"
+             << "  Defaulting to simulated remote execution\n";
+      Target.reset(new RemoteTarget);
+#else
+      if (!sys::fs::can_execute(ChildExecPath)) {
+        errs() << "Unable to find usable child executable: '" << ChildExecPath
+               << "'\n";
+        return -1;
       }
+      Target.reset(new RemoteTargetExternal(ChildExecPath));
+#endif
     } else {
       // No child process name provided, use simulated remote execution.
-      Target.reset(RemoteTarget::createRemoteTarget());
+      Target.reset(new RemoteTarget);
     }
 
     // Give the memory manager a pointer to our remote target interface object.





More information about the llvm-commits mailing list