[cfe-commits] r91962 - in /cfe/trunk: lib/Driver/Driver.cpp test/Driver/emit-llvm.c
Daniel Dunbar
daniel at zuster.org
Tue Dec 22 16:47:43 PST 2009
Author: ddunbar
Date: Tue Dec 22 18:47:42 2009
New Revision: 91962
URL: http://llvm.org/viewvc/llvm-project?rev=91962&view=rev
Log:
Driver: Fix '... -O4 -O0 ...', which was generating bitcode.
Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/emit-llvm.c
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=91962&r1=91961&r2=91962&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Dec 22 18:47:42 2009
@@ -739,6 +739,10 @@
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__analyze, options::OPT__analyze_auto)) {
@@ -746,8 +750,7 @@
} else if (Args.hasArg(options::OPT_emit_ast)) {
return new CompileJobAction(Input, types::TY_AST);
} else if (Args.hasArg(options::OPT_emit_llvm) ||
- Args.hasArg(options::OPT_flto) ||
- Args.hasArg(options::OPT_O4)) {
+ Args.hasArg(options::OPT_flto) || HasO4) {
types::ID Output =
Args.hasArg(options::OPT_S) ? types::TY_LLVMAsm : types::TY_LLVMBC;
return new CompileJobAction(Input, Output);
Modified: cfe/trunk/test/Driver/emit-llvm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/emit-llvm.c?rev=91962&r1=91961&r2=91962&view=diff
==============================================================================
--- cfe/trunk/test/Driver/emit-llvm.c (original)
+++ cfe/trunk/test/Driver/emit-llvm.c Tue Dec 22 18:47:42 2009
@@ -1,3 +1,13 @@
// RUN: not %clang -ccc-host-triple i386-pc-linux-gnu -emit-llvm -o %t %s 2> %t.log
// RUN: grep 'unable to pass LLVM bit-code files to linker' %t.log
+// Check that -O4 is only honored as the effective -O option.
+// <rdar://problem/7046672> clang/loader problem
+
+// RUN: %clang -ccc-print-phases -c -O4 -O0 %s 2> %t
+// RUN: FileCheck --check-prefix=O4_AND_O0 %s < %t
+
+// O4_AND_O0: 0: input, "{{.*}}", c
+// O4_AND_O0: 1: preprocessor, {0}, cpp-output
+// O4_AND_O0: 2: compiler, {1}, assembler
+// O4_AND_O0: 3: assembler, {2}, object
More information about the cfe-commits
mailing list