diff options
author | Mikhail Glushenkov <foldr@codedgers.com> | 2008-05-30 06:29:17 +0000 |
---|---|---|
committer | Mikhail Glushenkov <foldr@codedgers.com> | 2008-05-30 06:29:17 +0000 |
commit | 7329610dfa494864f38e9d99b4eb97898a5c9480 (patch) | |
tree | 54d9e2cca2afd7cc71eafc2c338be5aae27f52a0 /tools/llvmc2/CompilationGraph.cpp | |
parent | a7d0ae34fbcc587e4b357f33849c50127a166cf2 (diff) |
Add a --save-temps option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51760 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvmc2/CompilationGraph.cpp')
-rw-r--r-- | tools/llvmc2/CompilationGraph.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/llvmc2/CompilationGraph.cpp b/tools/llvmc2/CompilationGraph.cpp index df1f239565..9cdcac3845 100644 --- a/tools/llvmc2/CompilationGraph.cpp +++ b/tools/llvmc2/CompilationGraph.cpp @@ -139,8 +139,17 @@ void CompilationGraph::insertEdge(const std::string& A, Edge* Edg) { namespace { sys::Path MakeTempFile(const sys::Path& TempDir, const std::string& BaseName, const std::string& Suffix) { - sys::Path Out = TempDir; - Out.appendComponent(BaseName); + 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); Out.makeUnique(true, NULL); return Out; |