Driver::IsUsingLTO() no longer return true when seeing -emit-llvm.

One step toward differentiating following two commands:
   clang -O3 -flto a.c -c, and 
   clang -O3 -emit-llvm a.c

Thanks many awesome folks for clarifying things. 

llvm-svn: 189148
This commit is contained in:
Shuxin Yang 2013-08-23 21:34:57 +00:00
parent 274a023d70
commit 4b3c7ffc64
1 changed files with 5 additions and 3 deletions

View File

@ -1340,6 +1340,10 @@ Action *Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase,
types::ID Output = types::ID Output =
Args.hasArg(options::OPT_S) ? types::TY_LTO_IR : types::TY_LTO_BC; Args.hasArg(options::OPT_S) ? types::TY_LTO_IR : types::TY_LTO_BC;
return new CompileJobAction(Input, Output); return new CompileJobAction(Input, Output);
} else if (Args.hasArg(options::OPT_emit_llvm)) {
types::ID Output =
Args.hasArg(options::OPT_S) ? types::TY_LLVM_IR : types::TY_LLVM_BC;
return new CompileJobAction(Input, Output);
} else { } else {
return new CompileJobAction(Input, types::TY_PP_Asm); return new CompileJobAction(Input, types::TY_PP_Asm);
} }
@ -1352,9 +1356,7 @@ Action *Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase,
} }
bool Driver::IsUsingLTO(const ArgList &Args) const { bool Driver::IsUsingLTO(const ArgList &Args) const {
// Check for -emit-llvm or -flto. if (Args.hasFlag(options::OPT_flto, options::OPT_fno_lto, false))
if (Args.hasArg(options::OPT_emit_llvm) ||
Args.hasFlag(options::OPT_flto, options::OPT_fno_lto, false))
return true; return true;
// Check for -O4. // Check for -O4.