diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-06-29 16:38:33 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-06-29 16:38:33 +0000 |
commit | b5e2f698accd4d3a1379983304a2f31ec194c332 (patch) | |
tree | 7d73a4b2921898f55ea24b2a6723901bb28b999e /lib | |
parent | fe8ec01bba74f6841576a2ee93d2c62cdfa4eff2 (diff) |
Driver/Darwin: Only run dsymutil when we are also compiling/assembling as part
of the compilation.
- <rdar://problem/8141387> clang is always invoking dsymutil
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107149 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Driver/Driver.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 0dbe39c282..200e43842c 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -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 @@ void Driver::PrintActions(const Compilation &C) const { 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 @@ void Driver::BuildUniversalActions(const ArgList &Args, 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(); |