aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-11 17:51:16 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-11 17:51:16 +0000
commitc6cb2b02f0f4b3f162985803df3729b4def32108 (patch)
tree9e9ae06b3dd3f50434fe85256ff668495ec54f5d
parentd0a57d53223eccb482757c5aab436e8bd5a9c794 (diff)
Tweak GetPreamblePCHPath() to more closely match the behavior of the
Windows GetTempPath() function, and be sure to create the directory in which the precompiled preamble will reside before creating the temporary file itself. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113695 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Frontend/ASTUnit.cpp5
-rw-r--r--test/SemaTemplate/default-expr-arguments-2.cpp2
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index c76488b2c6..9fbaeeaac0 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -809,9 +809,14 @@ static std::string GetPreamblePCHPath() {
TmpDir = ::getenv("TEMP");
if (!TmpDir)
TmpDir = ::getenv("TMP");
+#ifdef LLVM_ON_WIN32
+ if (!TmpDir)
+ TmpDir = ::getenv("USERPROFILE");
+#endif
if (!TmpDir)
TmpDir = "/tmp";
llvm::sys::Path P(TmpDir);
+ P.createDirectoryOnDisk(true);
P.appendComponent("preamble");
P.appendSuffix("pch");
if (P.createTemporaryFileOnDisk())
diff --git a/test/SemaTemplate/default-expr-arguments-2.cpp b/test/SemaTemplate/default-expr-arguments-2.cpp
index 88cc43d644..378999d0d3 100644
--- a/test/SemaTemplate/default-expr-arguments-2.cpp
+++ b/test/SemaTemplate/default-expr-arguments-2.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -ast-dump %s 2>&1 | FileCheck %s
// This is a wacky test to ensure that we're actually instantiating
-// the default rguments of the constructor when the function type is
+// the default arguments of the constructor when the function type is
// otherwise non-dependent.
namespace PR6733 {
template <class T>