Replace the interim lli build fix with something cleaner
authorAlp Toker <alp@nuanti.com>
Thu, 23 Jan 2014 19:57:16 +0000 (19:57 +0000)
committerAlp Toker <alp@nuanti.com>
Thu, 23 Jan 2014 19:57:16 +0000 (19:57 +0000)
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!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199929 91177308-0d34-0410-b5e6-96231b3b80d8

tools/lli/ChildTarget/CMakeLists.txt
tools/lli/ChildTarget/Makefile
tools/lli/RemoteTarget.cpp
tools/lli/RemoteTarget.h
tools/lli/lli.cpp

index 50f114d9561c6fb25c0b39d77236044fbccc4244..6191fd601668fa212258bfee73743a1977034d11 100644 (file)
@@ -1,5 +1,4 @@
 set(LLVM_LINK_COMPONENTS support)
-add_definitions(-DLLI_BUILDING_CHILD)
 
 add_llvm_executable(lli-child-target
   ChildTarget.cpp
index 35a354156c307e2e7893f7b655d7cb006e717c47..6f4ddefcd59df424fcd2fe4a9940ffd20b685760 100644 (file)
@@ -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
index c3195e2154c17dcf250863eab478b722d295667a..561055f43bd0db4b3b8ab4a872df89aeb16881f3 100644 (file)
 
 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
 //
index 44e649e6e141f312681368a979981bd2b51fb04f..9803589eccf3e982f6e5555ef4aa14d39932fc7e 100644 (file)
@@ -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.
index e36d91795840d749dd0c3f97cd2ff337b4075b4d..7e928bebffbffd90a70125fe55cee209201605df 100644 (file)
@@ -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 * const *envp) {
 
     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.