diff options
| author | Olivier Goffart <ogoffart@woboq.com> | 2016-08-30 17:42:29 +0000 |
|---|---|---|
| committer | Olivier Goffart <ogoffart@woboq.com> | 2016-08-30 17:42:29 +0000 |
| commit | b37a5e3a71a6f20f9cae60538f6a25942c5256cc (patch) | |
| tree | c80014f206d758929347835c95d02074deff9be3 /clang/lib | |
| parent | 624cdc38034bfea022c8a85cd1c70d8c63589c0b (diff) | |
| download | bcm5719-llvm-b37a5e3a71a6f20f9cae60538f6a25942c5256cc.tar.gz bcm5719-llvm-b37a5e3a71a6f20f9cae60538f6a25942c5256cc.zip | |
Fix colored diagnostics from tools
r271042 changed the way the diagnostic arguments are parsed. It assumes that
the diagnostics options were already parsed by the "Driver".
For tools using clang::Tooling, the diagnostics argument were not parsed.
Differential Revision: https://reviews.llvm.org/D23837
llvm-svn: 280118
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Tooling/Tooling.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Tooling/Tooling.cpp b/clang/lib/Tooling/Tooling.cpp index 96118713b08..162a4914dec 100644 --- a/clang/lib/Tooling/Tooling.cpp +++ b/clang/lib/Tooling/Tooling.cpp @@ -15,6 +15,7 @@ #include "clang/Tooling/Tooling.h" #include "clang/Driver/Compilation.h" #include "clang/Driver/Driver.h" +#include "clang/Driver/Options.h" #include "clang/Driver/Tool.h" #include "clang/Driver/ToolChain.h" #include "clang/Frontend/ASTUnit.h" @@ -26,6 +27,7 @@ #include "clang/Tooling/CompilationDatabase.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Config/llvm-config.h" +#include "llvm/Option/ArgList.h" #include "llvm/Option/Option.h" #include "llvm/Support/Debug.h" #include "llvm/Support/FileSystem.h" @@ -241,6 +243,12 @@ bool ToolInvocation::run() { Argv.push_back(Str.c_str()); const char *const BinaryName = Argv[0]; IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions(); + unsigned MissingArgIndex, MissingArgCount; + llvm::opt::InputArgList ParsedArgs = + driver::createDriverOptTable()->ParseArgs( + ArrayRef<const char *>(Argv).slice(1), MissingArgIndex, + MissingArgCount); + ParseDiagnosticArgs(*DiagOpts, ParsedArgs); TextDiagnosticPrinter DiagnosticPrinter( llvm::errs(), &*DiagOpts); DiagnosticsEngine Diagnostics( |

