Index: cfe/trunk/lib/Driver/Driver.cpp =================================================================== --- cfe/trunk/lib/Driver/Driver.cpp +++ cfe/trunk/lib/Driver/Driver.cpp @@ -4263,6 +4263,8 @@ Arg *A = C.getArgs().getLastArg(options::OPT_fcrash_diagnostics_dir); if (CCGenDiagnostics && A) { SmallString<128> CrashDirectory(A->getValue()); + if (!getVFS().exists(CrashDirectory)) + llvm::sys::fs::create_directories(CrashDirectory); llvm::sys::path::append(CrashDirectory, Split.first); const char *Middle = Suffix ? "-%%%%%%." : "-%%%%%%"; std::error_code EC = llvm::sys::fs::createUniqueFile( Index: cfe/trunk/test/Driver/crash-diagnostics-dir.c =================================================================== --- cfe/trunk/test/Driver/crash-diagnostics-dir.c +++ cfe/trunk/test/Driver/crash-diagnostics-dir.c @@ -1,5 +1,4 @@ // RUN: rm -rf %t -// RUN: mkdir -p %t // RUN: not %clang -fcrash-diagnostics-dir=%t -c %s -o - 2>&1 | FileCheck %s #pragma clang __debug parser_crash // CHECK: Preprocessed source(s) and associated run script(s) are located at: