From ada4fa7978dc91a5e615af2ec29e12e3c6973c7f Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 25 Jan 2012 20:00:43 +0000 Subject: [PATCH] [driver] Do emit the diagnostics when CompilerInvocation::CreateFromArgs() fails. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148970 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Driver/unknown-arg.c | 4 ++++ tools/driver/cc1_main.cpp | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 test/Driver/unknown-arg.c diff --git a/test/Driver/unknown-arg.c b/test/Driver/unknown-arg.c new file mode 100644 index 0000000000..5d0f7afc51 --- /dev/null +++ b/test/Driver/unknown-arg.c @@ -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 diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index 0a14fdd315..ad3f3502ec 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -140,8 +140,6 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, 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 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, static_cast(&Clang->getDiagnostics())); DiagsBuffer->FlushDiagnostics(Clang->getDiagnostics()); + if (!Success) + return 1; // Execute the frontend actions. Success = ExecuteCompilerInvocation(Clang.get()); -- 2.40.0