Produce an error when trying to link with -emit-llvm.

llvm-svn: 189193
This commit is contained in:
Rafael Espindola 2013-08-25 14:27:09 +00:00
parent a4fe3a1259
commit e8025644b2
3 changed files with 8 additions and 0 deletions

View File

@ -109,6 +109,8 @@ def err_drv_mg_requires_m_or_mm : Error<
"option '-MG' requires '-M' or '-MM'">;
def err_drv_unknown_objc_runtime : Error<
"unknown or ill-formed Objective-C runtime '%0'">;
def err_drv_emit_llvm_link : Error<
"-emit-llvm cannot be used when linking">;
def warn_c_kext : Warning<
"ignoring -fapple-kext which is valid for C++ and Objective-C++ only">;

View File

@ -1171,6 +1171,10 @@ void Driver::BuildActions(const ToolChain &TC, DerivedArgList &Args,
Arg *FinalPhaseArg;
phases::ID FinalPhase = getFinalPhase(Args, &FinalPhaseArg);
if (FinalPhase == phases::Link && Args.hasArg(options::OPT_emit_llvm)) {
Diag(clang::diag::err_drv_emit_llvm_link);
}
// Reject -Z* at the top level, these options should never have been exposed
// by gcc.
if (Arg *A = Args.getLastArg(options::OPT_Z_Joined))

View File

@ -18,3 +18,5 @@
// RUN: %clang %s -flto -S -### 2> %t.log
// RUN: grep '"-o" ".*lto\.s" "-x" "c" ".*lto\.c"' %t.log
// RUN: not %clang %s -emit-llvm 2>&1 | FileCheck --check-prefix=LLVM-LINK %s
// LLVM-LINK: -emit-llvm cannot be used when linking