summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvmc/driver/Tool.cpp
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2009-03-02 09:01:14 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2009-03-02 09:01:14 +0000
commit931d4521c33df446cf4f5a8ae168a8001556693f (patch)
tree21923e5f5c09631cbaf3159c5b790a96e6c8871b /llvm/tools/llvmc/driver/Tool.cpp
parent57359cad176d71f47203d5d486e2563e70dc58e0 (diff)
downloadbcm5719-llvm-931d4521c33df446cf4f5a8ae168a8001556693f.tar.gz
bcm5719-llvm-931d4521c33df446cf4f5a8ae168a8001556693f.zip
Reorganize llvmc code.
Move the code from 'llvmc/driver' into a new CompilerDriver library, and change the build system accordingly. Makes it easier for projects using LLVM to build their own llvmc-based drivers. Tested with objdir != srcdir. llvm-svn: 65821
Diffstat (limited to 'llvm/tools/llvmc/driver/Tool.cpp')
-rw-r--r--llvm/tools/llvmc/driver/Tool.cpp74
1 files changed, 0 insertions, 74 deletions
diff --git a/llvm/tools/llvmc/driver/Tool.cpp b/llvm/tools/llvmc/driver/Tool.cpp
deleted file mode 100644
index 886b26b5d71..00000000000
--- a/llvm/tools/llvmc/driver/Tool.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-//===--- Tool.cpp - The LLVM Compiler Driver --------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open
-// Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Tool base class - implementation details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/CompilerDriver/Tool.h"
-
-#include "llvm/System/Path.h"
-#include "llvm/Support/CommandLine.h"
-
-using namespace llvm;
-using namespace llvmc;
-
-extern cl::opt<std::string> OutputFilename;
-
-namespace {
- sys::Path MakeTempFile(const sys::Path& TempDir, const std::string& BaseName,
- const std::string& Suffix) {
- sys::Path Out;
-
- // Make sure we don't end up with path names like '/file.o' if the
- // TempDir is empty.
- if (TempDir.empty()) {
- Out.set(BaseName);
- }
- else {
- Out = TempDir;
- Out.appendComponent(BaseName);
- }
- Out.appendSuffix(Suffix);
- // NOTE: makeUnique always *creates* a unique temporary file,
- // which is good, since there will be no races. However, some
- // tools do not like it when the output file already exists, so
- // they have to be placated with -f or something like that.
- Out.makeUnique(true, NULL);
- return Out;
- }
-}
-
-sys::Path Tool::OutFilename(const sys::Path& In,
- const sys::Path& TempDir,
- bool StopCompilation,
- const char* OutputSuffix) const {
- sys::Path Out;
-
- if (StopCompilation) {
- if (!OutputFilename.empty()) {
- Out.set(OutputFilename);
- }
- else if (IsJoin()) {
- Out.set("a");
- Out.appendSuffix(OutputSuffix);
- }
- else {
- Out.set(In.getBasename());
- Out.appendSuffix(OutputSuffix);
- }
- }
- else {
- if (IsJoin())
- Out = MakeTempFile(TempDir, "tmp", OutputSuffix);
- else
- Out = MakeTempFile(TempDir, In.getBasename(), OutputSuffix);
- }
- return Out;
-}
OpenPOWER on IntegriCloud