diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-04-12 23:59:20 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-04-12 23:59:20 +0000 |
commit | dc8355e81a94f5d5e09390f5d98860eedb212121 (patch) | |
tree | e59aebfeff4c193632d738336ef060570e3b529f | |
parent | 539d96f01df86d11c2ae6d92b5dc53cf3f726591 (diff) | |
download | bcm5719-llvm-dc8355e81a94f5d5e09390f5d98860eedb212121.tar.gz bcm5719-llvm-dc8355e81a94f5d5e09390f5d98860eedb212121.zip |
Driver/no-integrated-as: Fix forwarding of -g flag to assembler, when .s input
undergoes preprocessing.
llvm-svn: 129414
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 287056fc7b4..86c0fe8932f 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -2604,11 +2604,16 @@ void darwin::Assemble::ConstructJob(Compilation &C, const JobAction &JA, assert(Inputs.size() == 1 && "Unexpected number of inputs."); const InputInfo &Input = Inputs[0]; - // Bit of a hack, this is only used for original inputs. - // - // FIXME: This is broken for preprocessed .s inputs. - if (Input.isFilename() && - strcmp(Input.getFilename(), Input.getBaseInput()) == 0) { + // Determine the original source input. + const Action *SourceAction = &JA; + while (SourceAction->getKind() != Action::InputClass) { + assert(!SourceAction->getInputs().empty() && "unexpected root action!"); + SourceAction = SourceAction->getInputs()[0]; + } + + // Forward -g, assuming we are dealing with an actual assembly file. + if (SourceAction->getType() == types::TY_Asm || + SourceAction->getType() == types::TY_PP_Asm) { if (Args.hasArg(options::OPT_gstabs)) CmdArgs.push_back("--gstabs"); else if (Args.hasArg(options::OPT_g_Group)) |