Author: Yuanfang Chen Date: 2022-09-27T13:14:16-07:00 New Revision: 5839fb6d25b4ba6edb4d9a707c75bffd178d6cc6
URL: https://github.com/llvm/llvm-project/commit/5839fb6d25b4ba6edb4d9a707c75bffd178d6cc6 DIFF: https://github.com/llvm/llvm-project/commit/5839fb6d25b4ba6edb4d9a707c75bffd178d6cc6.diff LOG: [Driver] pass -fcrash-diagnostics-dir to LTO So the behavior is consistent with non-LTO mode. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D134657 Added: Modified: clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/crash-diagnostics-dir-2.c Removed: ################################################################################ diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index d0abc4a0e26c..c926e98a7f9e 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -632,6 +632,11 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, CmdArgs.push_back( Args.MakeArgString(Twine("-plugin-opt=stats-file=") + StatsFile)); + // Setup crash diagnostics dir. + if (Arg *A = Args.getLastArg(options::OPT_fcrash_diagnostics_dir)) + CmdArgs.push_back(Args.MakeArgString( + Twine("-plugin-opt=-crash-diagnostics-dir=") + A->getValue())); + addX86AlignBranchArgs(D, Args, CmdArgs, /*IsLTO=*/true); // Handle remark diagnostics on screen options: '-Rpass-*'. diff --git a/clang/test/Driver/crash-diagnostics-dir-2.c b/clang/test/Driver/crash-diagnostics-dir-2.c index 432a8893f878..664acd9b7959 100644 --- a/clang/test/Driver/crash-diagnostics-dir-2.c +++ b/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" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits