r189193 - Produce an error when trying to link with -emit-llvm.
Rafael Espindola
rafael.espindola at gmail.com
Sun Aug 25 07:27:09 PDT 2013
Author: rafael
Date: Sun Aug 25 09:27:09 2013
New Revision: 189193
URL: http://llvm.org/viewvc/llvm-project?rev=189193&view=rev
Log:
Produce an error when trying to link with -emit-llvm.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/lto.c
Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=189193&r1=189192&r2=189193&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Sun Aug 25 09:27:09 2013
@@ -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">;
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=189193&r1=189192&r2=189193&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Sun Aug 25 09:27:09 2013
@@ -1171,6 +1171,10 @@ void Driver::BuildActions(const ToolChai
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))
Modified: cfe/trunk/test/Driver/lto.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/lto.c?rev=189193&r1=189192&r2=189193&view=diff
==============================================================================
--- cfe/trunk/test/Driver/lto.c (original)
+++ cfe/trunk/test/Driver/lto.c Sun Aug 25 09:27:09 2013
@@ -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
More information about the cfe-commits
mailing list