[llvm-branch-commits] [cfe-branch] r107151 - in /cfe/branches/Apple/whitney-IB/src/tools/clang: lib/Driver/Driver.cpp test/Driver/darwin-dsymutil.c
Daniel Dunbar
daniel at zuster.org
Tue Jun 29 09:47:52 PDT 2010
Author: ddunbar
Date: Tue Jun 29 11:47:52 2010
New Revision: 107151
URL: http://llvm.org/viewvc/llvm-project?rev=107151&view=rev
Log:
Merge r107149, "Driver/Darwin: Only run dsymutil when we are also compiling/assembling as part of the compilation."
Modified:
cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Driver/Driver.cpp
cfe/branches/Apple/whitney-IB/src/tools/clang/test/Driver/darwin-dsymutil.c
Modified: cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Driver/Driver.cpp?rev=107151&r1=107150&r2=107151&view=diff
==============================================================================
--- cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Driver/Driver.cpp (original)
+++ cfe/branches/Apple/whitney-IB/src/tools/clang/lib/Driver/Driver.cpp Tue Jun 29 11:47:52 2010
@@ -39,9 +39,6 @@
using namespace clang::driver;
using namespace clang;
-// Used to set values for "production" clang, for releases.
-// #define USE_PRODUCTION_CLANG
-
Driver::Driver(llvm::StringRef _Name, llvm::StringRef _Dir,
llvm::StringRef _DefaultHostTriple,
llvm::StringRef _DefaultImageName,
@@ -510,6 +507,19 @@
PrintActions1(C, *it, Ids);
}
+/// \brief Check whether the given input tree contains any compilation (or
+/// assembly) actions.
+static bool ContainsCompileAction(const Action *A) {
+ if (isa<CompileJobAction>(A) || isa<AssembleJobAction>(A))
+ return true;
+
+ for (Action::const_iterator it = A->begin(), ie = A->end(); it != ie; ++it)
+ if (ContainsCompileAction(*it))
+ return true;
+
+ return false;
+}
+
void Driver::BuildUniversalActions(const ArgList &Args,
ActionList &Actions) const {
llvm::PrettyStackTraceString CrashInfo("Building universal build actions");
@@ -586,11 +596,15 @@
else
Actions.push_back(new LipoJobAction(Inputs, Act->getType()));
- // Add a 'dsymutil' step if necessary.
+ // 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 is
+ // will be removed at the end of the compilation process.
if (Act->getType() == types::TY_Image) {
Arg *A = Args.getLastArg(options::OPT_g_Group);
if (A && !A->getOption().matches(options::OPT_g0) &&
- !A->getOption().matches(options::OPT_gstabs)) {
+ !A->getOption().matches(options::OPT_gstabs) &&
+ ContainsCompileAction(Actions.back())) {
ActionList Inputs;
Inputs.push_back(Actions.back());
Actions.pop_back();
Modified: cfe/branches/Apple/whitney-IB/src/tools/clang/test/Driver/darwin-dsymutil.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney-IB/src/tools/clang/test/Driver/darwin-dsymutil.c?rev=107151&r1=107150&r2=107151&view=diff
==============================================================================
--- cfe/branches/Apple/whitney-IB/src/tools/clang/test/Driver/darwin-dsymutil.c (original)
+++ cfe/branches/Apple/whitney-IB/src/tools/clang/test/Driver/darwin-dsymutil.c Tue Jun 29 11:47:52 2010
@@ -29,3 +29,10 @@
//
// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Link", inputs: [{{.*}}], output: "foo"
// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: ["foo"], output: "foo.dSYM"
+
+// Check that we only use dsymutil when needed.
+//
+// RUN: touch %t.o
+// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -ccc-print-bindings \
+// RUN: -o foo %t.o -g 2> %t
+// RUN: grep "Dsymutil" %t | count 0
More information about the llvm-branch-commits
mailing list