clang-cl: Avoid confusing diagnostics when clang-cl is called just cl.exe

llvm-svn: 189901
This commit is contained in:
Reid Kleckner 2013-09-04 01:37:22 +00:00
parent 8bd0ac1135
commit dc74af1ab8
1 changed files with 8 additions and 1 deletions

View File

@ -346,7 +346,14 @@ int main(int argc_, const char **argv_) {
// DiagnosticOptions instance.
TextDiagnosticPrinter *DiagClient
= new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts);
DiagClient->setPrefix(llvm::sys::path::filename(Path));
// If the clang binary happens to be named cl.exe for compatibility reasons,
// use clang-cl.exe as the prefix to avoid confusion between clang and MSVC.
StringRef ExeBasename(llvm::sys::path::filename(Path));
if (ExeBasename.trim().equals_lower("cl.exe"))
ExeBasename = "clang-cl.exe";
DiagClient->setPrefix(ExeBasename);
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagClient);