summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
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
commitce3449f5bd466079e3453380869c58cca3e73d1a (patch)
tree3fa296d9845dedc64d45f2ac3226a436a2c455a3 /clang/lib/Frontend
parent1bbb14ab8f684ac80cc15e1af338d37be3f6a054 (diff)
downloadbcm5719-llvm-ce3449f5bd466079e3453380869c58cca3e73d1a.tar.gz
bcm5719-llvm-ce3449f5bd466079e3453380869c58cca3e73d1a.zip
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. llvm-svn: 113695
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index c76488b2c62..9fbaeeaac04 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/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())
OpenPOWER on IntegriCloud