[cfe-commits] r133542 - in /cfe/trunk: include/clang/Driver/Driver.h lib/Driver/Driver.cpp
Daniel Dunbar
daniel at zuster.org
Tue Jun 21 13:55:08 PDT 2011
Author: ddunbar
Date: Tue Jun 21 15:55:08 2011
New Revision: 133542
URL: http://llvm.org/viewvc/llvm-project?rev=133542&view=rev
Log:
Driver: Factor out IsUsingLTO helper function.
Modified:
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/lib/Driver/Driver.cpp
Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=133542&r1=133541&r2=133542&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Tue Jun 21 15:55:08 2011
@@ -357,6 +357,8 @@
bool ShouldUseClangCompiler(const Compilation &C, const JobAction &JA,
const llvm::Triple &ArchName) const;
+ bool IsUsingLTO(const ArgList &Args) const;
+
/// @}
/// GetReleaseVersion - Parse (([0-9]+)(.([0-9]+)(.([0-9]+)?))?)? and
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=133542&r1=133541&r2=133542&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Jun 21 15:55:08 2011
@@ -942,10 +942,6 @@
case phases::Precompile:
return new PrecompileJobAction(Input, types::TY_PCH);
case phases::Compile: {
- bool HasO4 = false;
- if (const Arg *A = Args.getLastArg(options::OPT_O_Group))
- HasO4 = A->getOption().matches(options::OPT_O4);
-
if (Args.hasArg(options::OPT_fsyntax_only)) {
return new CompileJobAction(Input, types::TY_Nothing);
} else if (Args.hasArg(options::OPT_rewrite_objc)) {
@@ -954,9 +950,7 @@
return new AnalyzeJobAction(Input, types::TY_Plist);
} else if (Args.hasArg(options::OPT_emit_ast)) {
return new CompileJobAction(Input, types::TY_AST);
- } else if (Args.hasArg(options::OPT_emit_llvm) ||
- Args.hasFlag(options::OPT_flto, options::OPT_fno_lto, false) ||
- HasO4) {
+ } else if (IsUsingLTO(Args)) {
types::ID Output =
Args.hasArg(options::OPT_S) ? types::TY_LTO_IR : types::TY_LTO_BC;
return new CompileJobAction(Input, Output);
@@ -972,6 +966,19 @@
return 0;
}
+bool Driver::IsUsingLTO(const ArgList &Args) const {
+ // Check for -emit-llvm or -flto.
+ if (Args.hasArg(options::OPT_emit_llvm) ||
+ Args.hasFlag(options::OPT_flto, options::OPT_fno_lto, false))
+ return true;
+
+ // Check for -O4.
+ if (const Arg *A = Args.getLastArg(options::OPT_O_Group))
+ return A->getOption().matches(options::OPT_O4);
+
+ return false;
+}
+
void Driver::BuildJobs(Compilation &C) const {
llvm::PrettyStackTraceString CrashInfo("Building compilation jobs");
More information about the cfe-commits
mailing list