From 223ccb4328e7b22db2aa3559c8fca1fd3343820d Mon Sep 17 00:00:00 2001 From: Shuxin Yang Date: Fri, 23 Aug 2013 21:34:57 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189148 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Driver.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index f3b8beb94b..09da30d2bc 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1340,6 +1340,10 @@ Action *Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase, types::ID Output = Args.hasArg(options::OPT_S) ? types::TY_LTO_IR : types::TY_LTO_BC; 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 { 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 { - // Check for -emit-llvm or -flto. - if (Args.hasArg(options::OPT_emit_llvm) || - Args.hasFlag(options::OPT_flto, options::OPT_fno_lto, false)) + if (Args.hasFlag(options::OPT_flto, options::OPT_fno_lto, false)) return true; // Check for -O4. -- 2.40.0