]> granicus.if.org Git - clang/commitdiff
Tweak GetPreamblePCHPath() to more closely match the behavior of the
authorDouglas Gregor <dgregor@apple.com>
Sat, 11 Sep 2010 17:51:16 +0000 (17:51 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sat, 11 Sep 2010 17:51:16 +0000 (17:51 +0000)
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

lib/Frontend/ASTUnit.cpp
test/SemaTemplate/default-expr-arguments-2.cpp

index c76488b2c62c6592d4a77be7da6d30597e38578e..9fbaeeaac04ef53bf8ba0c8cc58289b46694531b 100644 (file)
@@ -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())
index 88cc43d6445e146629dc52639de8e68b02c4bb72..378999d0d3c47d3481afd75db4711446113bed87 100644 (file)
@@ -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>