[cfe-commits] r94463 - in /cfe/trunk/lib/Driver: Tools.cpp Tools.h
Daniel Dunbar
daniel at zuster.org
Mon Jan 25 14:35:08 PST 2010
Author: ddunbar
Date: Mon Jan 25 16:35:08 2010
New Revision: 94463
URL: http://llvm.org/viewvc/llvm-project?rev=94463&view=rev
Log:
Driver: Fix fallback to gcc to -c instead of -S if trying to generate an LLVM bc
file.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Tools.h
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=94463&r1=94462&r2=94463&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Jan 25 16:35:08 2010
@@ -1213,7 +1213,7 @@
}
}
- RenderExtraToolArgs(CmdArgs);
+ RenderExtraToolArgs(JA, CmdArgs);
// If using a driver driver, force the arch.
const std::string &Arch = getToolChain().getArchName();
@@ -1291,23 +1291,32 @@
Dest.addCommand(new Command(JA, *this, Exec, CmdArgs));
}
-void gcc::Preprocess::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
+void gcc::Preprocess::RenderExtraToolArgs(const JobAction &JA,
+ ArgStringList &CmdArgs) const {
CmdArgs.push_back("-E");
}
-void gcc::Precompile::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
+void gcc::Precompile::RenderExtraToolArgs(const JobAction &JA,
+ ArgStringList &CmdArgs) const {
// The type is good enough.
}
-void gcc::Compile::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
- CmdArgs.push_back("-S");
+void gcc::Compile::RenderExtraToolArgs(const JobAction &JA,
+ ArgStringList &CmdArgs) const {
+ // If -flto, etc. are present then make sure not to force assembly output.
+ if (JA.getType() == types::TY_LLVMBC)
+ CmdArgs.push_back("-c");
+ else
+ CmdArgs.push_back("-S");
}
-void gcc::Assemble::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
+void gcc::Assemble::RenderExtraToolArgs(const JobAction &JA,
+ ArgStringList &CmdArgs) const {
CmdArgs.push_back("-c");
}
-void gcc::Link::RenderExtraToolArgs(ArgStringList &CmdArgs) const {
+void gcc::Link::RenderExtraToolArgs(const JobAction &JA,
+ ArgStringList &CmdArgs) const {
// The types are (hopefully) good enough.
}
Modified: cfe/trunk/lib/Driver/Tools.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=94463&r1=94462&r2=94463&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.h (original)
+++ cfe/trunk/lib/Driver/Tools.h Mon Jan 25 16:35:08 2010
@@ -66,7 +66,8 @@
/// RenderExtraToolArgs - Render any arguments necessary to force
/// the particular tool mode.
- virtual void RenderExtraToolArgs(ArgStringList &CmdArgs) const = 0;
+ virtual void RenderExtraToolArgs(const JobAction &JA,
+ ArgStringList &CmdArgs) const = 0;
};
@@ -78,7 +79,8 @@
virtual bool canPipeOutput() const { return true; }
virtual bool hasIntegratedCPP() const { return false; }
- virtual void RenderExtraToolArgs(ArgStringList &CmdArgs) const;
+ virtual void RenderExtraToolArgs(const JobAction &JA,
+ ArgStringList &CmdArgs) const;
};
class VISIBILITY_HIDDEN Precompile : public Common {
@@ -89,7 +91,8 @@
virtual bool canPipeOutput() const { return false; }
virtual bool hasIntegratedCPP() const { return true; }
- virtual void RenderExtraToolArgs(ArgStringList &CmdArgs) const;
+ virtual void RenderExtraToolArgs(const JobAction &JA,
+ ArgStringList &CmdArgs) const;
};
class VISIBILITY_HIDDEN Compile : public Common {
@@ -100,7 +103,8 @@
virtual bool canPipeOutput() const { return true; }
virtual bool hasIntegratedCPP() const { return true; }
- virtual void RenderExtraToolArgs(ArgStringList &CmdArgs) const;
+ virtual void RenderExtraToolArgs(const JobAction &JA,
+ ArgStringList &CmdArgs) const;
};
class VISIBILITY_HIDDEN Assemble : public Common {
@@ -111,7 +115,8 @@
virtual bool canPipeOutput() const { return false; }
virtual bool hasIntegratedCPP() const { return false; }
- virtual void RenderExtraToolArgs(ArgStringList &CmdArgs) const;
+ virtual void RenderExtraToolArgs(const JobAction &JA,
+ ArgStringList &CmdArgs) const;
};
class VISIBILITY_HIDDEN Link : public Common {
@@ -122,7 +127,8 @@
virtual bool canPipeOutput() const { return false; }
virtual bool hasIntegratedCPP() const { return false; }
- virtual void RenderExtraToolArgs(ArgStringList &CmdArgs) const;
+ virtual void RenderExtraToolArgs(const JobAction &JA,
+ ArgStringList &CmdArgs) const;
};
} // end namespace gcc
More information about the cfe-commits
mailing list