summaryrefslogtreecommitdiff
path: root/tools/lli
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-01-23 19:57:16 +0000
committerAlp Toker <alp@nuanti.com>2014-01-23 19:57:16 +0000
commitfe32bb78333e92278bc974044d22dc7f64f134ba (patch)
tree24afccdef762739997855e7577e3babdca637a54 /tools/lli
parentebcaef4340f8e2b07f7374d30642df1081a5b9cb (diff)
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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199929 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lli')
-rw-r--r--tools/lli/ChildTarget/CMakeLists.txt1
-rw-r--r--tools/lli/ChildTarget/Makefile2
-rw-r--r--tools/lli/RemoteTarget.cpp25
-rw-r--r--tools/lli/RemoteTarget.h5
-rw-r--r--tools/lli/lli.cpp27
5 files changed, 15 insertions, 45 deletions
diff --git a/tools/lli/ChildTarget/CMakeLists.txt b/tools/lli/ChildTarget/CMakeLists.txt
index 50f114d9561..6191fd60166 100644
--- a/tools/lli/ChildTarget/CMakeLists.txt
+++ b/tools/lli/ChildTarget/CMakeLists.txt
@@ -1,5 +1,4 @@
set(LLVM_LINK_COMPONENTS support)
-add_definitions(-DLLI_BUILDING_CHILD)
add_llvm_executable(lli-child-target
ChildTarget.cpp
diff --git a/tools/lli/ChildTarget/Makefile b/tools/lli/ChildTarget/Makefile
index 35a354156c3..6f4ddefcd59 100644
--- a/tools/lli/ChildTarget/Makefile
+++ b/tools/lli/ChildTarget/Makefile
@@ -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
diff --git a/tools/lli/RemoteTarget.cpp b/tools/lli/RemoteTarget.cpp
index c3195e2154c..561055f43bd 100644
--- a/tools/lli/RemoteTarget.cpp
+++ b/tools/lli/RemoteTarget.cpp
@@ -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
//
diff --git a/tools/lli/RemoteTarget.h b/tools/lli/RemoteTarget.h
index 44e649e6e14..9803589eccf 100644
--- a/tools/lli/RemoteTarget.h
+++ b/tools/lli/RemoteTarget.h
@@ -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.
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp
index e36d9179584..7e928bebffb 100644
--- a/tools/lli/lli.cpp
+++ b/tools/lli/lli.cpp
@@ -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.