From: Douglas Gregor Date: Sat, 11 Sep 2010 17:51:16 +0000 (+0000) Subject: Tweak GetPreamblePCHPath() to more closely match the behavior of the X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c6cb2b02f0f4b3f162985803df3729b4def32108;p=clang 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 --- 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