r359954 - [Driver] Create non-existent directory for -fcrash-diagnostics-dir
Petr Hosek via cfe-commits
cfe-commits at lists.llvm.org
Fri May 3 17:55:14 PDT 2019
Author: phosek
Date: Fri May 3 17:55:14 2019
New Revision: 359954
URL: http://llvm.org/viewvc/llvm-project?rev=359954&view=rev
Log:
[Driver] Create non-existent directory for -fcrash-diagnostics-dir
When user specifies non-existent directory to -fcrash-diagnostics-dir,
create it rather than failing with an error as would be the case before.
Differential Revision: https://reviews.llvm.org/D61542
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/crash-diagnostics-dir.c
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=359954&r1=359953&r2=359954&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri May 3 17:55:14 2019
@@ -4263,6 +4263,8 @@ const char *Driver::GetNamedOutputPath(C
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(
Modified: cfe/trunk/test/Driver/crash-diagnostics-dir.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/crash-diagnostics-dir.c?rev=359954&r1=359953&r2=359954&view=diff
==============================================================================
--- cfe/trunk/test/Driver/crash-diagnostics-dir.c (original)
+++ cfe/trunk/test/Driver/crash-diagnostics-dir.c Fri May 3 17:55:14 2019
@@ -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:
More information about the cfe-commits
mailing list