beanz updated this revision to Diff 280641.
beanz added a comment.
Fixing bad test case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84565/new/
https://reviews.llvm.org/D84565
Files:
clang/lib/Driver/Driver.cpp
clang/test/Driver/darwin-dsymutil.c
Index: clang/test/Driver/darwin-dsymutil.c
===================================================================
--- clang/test/Driver/darwin-dsymutil.c
+++ clang/test/Driver/darwin-dsymutil.c
@@ -47,3 +47,11 @@
// Check that we don't crash when translating arguments for dsymutil.
// RUN: %clang -m32 -arch x86_64 -g %s -###
+
+// Check that we run dsymutil when -flto is specified and no source is provided
+// RUN: touch %t.o
+// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
+// RUN: -arch x86_64 %t.o -g -flto 2> %t
+// RUN: FileCheck -check-prefix=CHECK-DSYMUTIL-LTO < %t %s
+
+// CHECK-DSYMUTIL-LTO: x86_64-apple-darwin10" - "darwin::Dsymutil", inputs:
["a.out"], output: "a.out.dSYM"
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -2033,13 +2033,17 @@
Arg *A = Args.getLastArg(options::OPT_g_Group);
bool enablesDebugInfo = A && !A->getOption().matches(options::OPT_g0) &&
!A->getOption().matches(options::OPT_gstabs);
+ bool isGeneratingTemporaryObject =
+ ContainsCompileOrAssembleAction(Actions.back()) || LTOMode !=
LTOK_None;
if ((enablesDebugInfo || willEmitRemarks(Args)) &&
- ContainsCompileOrAssembleAction(Actions.back())) {
+ isGeneratingTemporaryObject) {
// Add a 'dsymutil' step if necessary, when debug info is enabled and we
- // have a compile input. We need to run 'dsymutil' ourselves in such
cases
- // because the debug info will refer to a temporary object file which
- // will be removed at the end of the compilation process.
+ // are linking a temporary object. This occurs when we have a compiler
+ // or assmbler input or if LTO is enabled. We need to run 'dsymutil'
+ // ourselves in such cases because the debug info will refer to the
+ // temporary object file which will be removed at the end of the
+ // compilation process.
if (Act->getType() == types::TY_Image) {
ActionList Inputs;
Inputs.push_back(Actions.back());
Index: clang/test/Driver/darwin-dsymutil.c
===================================================================
--- clang/test/Driver/darwin-dsymutil.c
+++ clang/test/Driver/darwin-dsymutil.c
@@ -47,3 +47,11 @@
// Check that we don't crash when translating arguments for dsymutil.
// RUN: %clang -m32 -arch x86_64 -g %s -###
+
+// Check that we run dsymutil when -flto is specified and no source is provided
+// RUN: touch %t.o
+// RUN: %clang -target x86_64-apple-darwin10 -ccc-print-bindings \
+// RUN: -arch x86_64 %t.o -g -flto 2> %t
+// RUN: FileCheck -check-prefix=CHECK-DSYMUTIL-LTO < %t %s
+
+// CHECK-DSYMUTIL-LTO: x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: ["a.out"], output: "a.out.dSYM"
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -2033,13 +2033,17 @@
Arg *A = Args.getLastArg(options::OPT_g_Group);
bool enablesDebugInfo = A && !A->getOption().matches(options::OPT_g0) &&
!A->getOption().matches(options::OPT_gstabs);
+ bool isGeneratingTemporaryObject =
+ ContainsCompileOrAssembleAction(Actions.back()) || LTOMode != LTOK_None;
if ((enablesDebugInfo || willEmitRemarks(Args)) &&
- ContainsCompileOrAssembleAction(Actions.back())) {
+ isGeneratingTemporaryObject) {
// Add a 'dsymutil' step if necessary, when debug info is enabled and we
- // have a compile input. We need to run 'dsymutil' ourselves in such cases
- // because the debug info will refer to a temporary object file which
- // will be removed at the end of the compilation process.
+ // are linking a temporary object. This occurs when we have a compiler
+ // or assmbler input or if LTO is enabled. We need to run 'dsymutil'
+ // ourselves in such cases because the debug info will refer to the
+ // temporary object file which will be removed at the end of the
+ // compilation process.
if (Act->getType() == types::TY_Image) {
ActionList Inputs;
Inputs.push_back(Actions.back());
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits