[PATCH] D134657: [Driver] pass -fcrash-diagnostics-dir to LTO
Yuanfang Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 26 10:28:31 PDT 2022
ychen created this revision.
ychen added reviewers: MaskRay, probinson.
Herald added subscribers: StephenFan, inglorion.
Herald added a project: All.
ychen requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
So the behavior is consistent with non-LTO mode.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D134657
Files:
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/crash-diagnostics-dir-2.c
Index: clang/test/Driver/crash-diagnostics-dir-2.c
===================================================================
--- clang/test/Driver/crash-diagnostics-dir-2.c
+++ clang/test/Driver/crash-diagnostics-dir-2.c
@@ -3,3 +3,12 @@
// OPTION: "-crash-diagnostics-dir=mydumps"
// RUN: %clang -### -c %s 2>&1 | FileCheck %s --check-prefix=NOOPTION
// NOOPTION-NOT: "-crash-diagnostics-dir
+
+// RUN: %clang -### -fcrash-diagnostics-dir=mydumps -flto %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=LTO-OPTION
+// LTO-OPTION: "-cc1"
+// LTO-OPTION: "-plugin-opt=-crash-diagnostics-dir=mydumps"
+
+// RUN: %clang -### -flto %s 2>&1 | FileCheck %s --check-prefix=LTO-NOOPTION
+// LTO-NOOPTION: "-cc1"
+// LTO-NOOPTION-NOT: "-plugin-opt=-crash-diagnostics-dir=mydumps"
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -631,6 +631,13 @@
CmdArgs.push_back(
Args.MakeArgString(Twine("-plugin-opt=stats-file=") + StatsFile));
+ // Setup crash diagnostics dir.
+ if (Args.hasArg(options::OPT_fcrash_diagnostics_dir)) {
+ StringRef Dir = Args.getLastArgValue(options::OPT_fcrash_diagnostics_dir);
+ CmdArgs.push_back(
+ Args.MakeArgString("-plugin-opt=-crash-diagnostics-dir=" + Dir));
+ }
+
addX86AlignBranchArgs(D, Args, CmdArgs, /*IsLTO=*/true);
// Handle remark diagnostics on screen options: '-Rpass-*'.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134657.462964.patch
Type: text/x-patch
Size: 1511 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220926/99184ab0/attachment.bin>
More information about the cfe-commits
mailing list