[cfe-commits] r129414 - /cfe/trunk/lib/Driver/Tools.cpp

Daniel Dunbar daniel at zuster.org
Tue Apr 12 16:59:20 PDT 2011


Author: ddunbar
Date: Tue Apr 12 18:59:20 2011
New Revision: 129414

URL: http://llvm.org/viewvc/llvm-project?rev=129414&view=rev
Log:
Driver/no-integrated-as: Fix forwarding of -g flag to assembler, when .s input
undergoes preprocessing.

Modified:
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=129414&r1=129413&r2=129414&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Apr 12 18:59:20 2011
@@ -2604,11 +2604,16 @@
   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))





More information about the cfe-commits mailing list