[PATCH] D61542: [Driver] Create non-existent directory for -fcrash-diagnostics-dir

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 3 17:53:10 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL359954: [Driver] Create non-existent directory for -fcrash-diagnostics-dir (authored by phosek, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61542?vs=198109&id=198117#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61542/new/

https://reviews.llvm.org/D61542

Files:
  cfe/trunk/lib/Driver/Driver.cpp
  cfe/trunk/test/Driver/crash-diagnostics-dir.c


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:
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(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61542.198117.patch
Type: text/x-patch
Size: 1123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190504/0359ba26/attachment.bin>


More information about the cfe-commits mailing list