[cfe-commits] r148970 - in /cfe/trunk: test/Driver/unknown-arg.c tools/driver/cc1_main.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Wed Jan 25 12:00:43 PST 2012
Author: akirtzidis
Date: Wed Jan 25 14:00:43 2012
New Revision: 148970
URL: http://llvm.org/viewvc/llvm-project?rev=148970&view=rev
Log:
[driver] Do emit the diagnostics when CompilerInvocation::CreateFromArgs() fails.
Added:
cfe/trunk/test/Driver/unknown-arg.c
Modified:
cfe/trunk/tools/driver/cc1_main.cpp
Added: cfe/trunk/test/Driver/unknown-arg.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/unknown-arg.c?rev=148970&view=auto
==============================================================================
--- cfe/trunk/test/Driver/unknown-arg.c (added)
+++ cfe/trunk/test/Driver/unknown-arg.c Wed Jan 25 14:00:43 2012
@@ -0,0 +1,4 @@
+// RUN: not %clang_cc1 %s -cake-is-lie 2> %t.log
+// RUN: FileCheck %s -input-file=%t.log
+
+// CHECK: unknown argument
Modified: cfe/trunk/tools/driver/cc1_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=148970&r1=148969&r2=148970&view=diff
==============================================================================
--- cfe/trunk/tools/driver/cc1_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1_main.cpp Wed Jan 25 14:00:43 2012
@@ -140,8 +140,6 @@
bool Success;
Success = CompilerInvocation::CreateFromArgs(Clang->getInvocation(),
ArgBegin, ArgEnd, Diags);
- if (!Success)
- return 1;
// Infer the builtin include path if unspecified.
if (Clang->getHeaderSearchOpts().UseBuiltinIncludes &&
@@ -160,6 +158,8 @@
static_cast<void*>(&Clang->getDiagnostics()));
DiagsBuffer->FlushDiagnostics(Clang->getDiagnostics());
+ if (!Success)
+ return 1;
// Execute the frontend actions.
Success = ExecuteCompilerInvocation(Clang.get());
More information about the cfe-commits
mailing list