[PATCH] D83828: [clang][Driver] update the default location for clang crash diagnostics.
Jian Cai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 14 15:58:15 PDT 2020
jcai19 created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
jcai19 planned changes to this revision.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D83828
Files:
clang/lib/Driver/Driver.cpp
clang/test/Driver/crash-report-header.h
Index: clang/test/Driver/crash-report-header.h
===================================================================
--- clang/test/Driver/crash-report-header.h
+++ clang/test/Driver/crash-report-header.h
@@ -1,8 +1,8 @@
// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: env TMPDIR="%t" TEMP="%t" TMP="%t" RC_DEBUG_OPTIONS=1 not %clang -fsyntax-only %s 2>&1 | FileCheck %s
-// RUN: cat %t/crash-report-header-*.h | FileCheck --check-prefix=CHECKSRC "%s"
-// RUN: cat %t/crash-report-header-*.sh | FileCheck --check-prefix=CHECKSH "%s"
+// RUN: cat %t/clang_crash_diagnostics-*/crash-report-header-*.h | FileCheck --check-prefix=CHECKSRC "%s"
+// RUN: cat %t/clang_crash_diagnostics-*/crash-report-header-*.sh | FileCheck --check-prefix=CHECKSH "%s"
// REQUIRES: crash-recovery
#pragma clang __debug parser_crash
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -4555,20 +4555,20 @@
SmallString<128> TmpName;
const char *Suffix = types::getTypeTempSuffix(JA.getType(), IsCLMode());
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(
- CrashDirectory + Middle + Suffix, TmpName);
- if (EC) {
- Diag(clang::diag::err_unable_to_make_temp) << EC.message();
- return "";
- }
- } else {
- TmpName = GetTemporaryPath(Split.first, Suffix);
+ SmallString<128> CrashDirectory;
+ if (CCGenDiagnostics && A)
+ CrashDirectory.assign(A->getValue());
+ else
+ CrashDirectory.assign(GetTemporaryDirectory("clang_crash_diagnostics"));
+ 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(
+ CrashDirectory + Middle + Suffix, TmpName);
+ if (EC) {
+ Diag(clang::diag::err_unable_to_make_temp) << EC.message();
+ return "";
}
return C.addTempFile(C.getArgs().MakeArgString(TmpName));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83828.278011.patch
Type: text/x-patch
Size: 2513 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200714/3340447e/attachment-0001.bin>
More information about the cfe-commits
mailing list