r189901 - clang-cl: Avoid confusing diagnostics when clang-cl is called just cl.exe
Richard Smith
richard at metafoo.co.uk
Tue Sep 3 18:46:49 PDT 2013
On Tue, Sep 3, 2013 at 6:37 PM, Reid Kleckner <reid at kleckner.net> wrote:
> Author: rnk
> Date: Tue Sep 3 20:37:22 2013
> New Revision: 189901
>
> URL: http://llvm.org/viewvc/llvm-project?rev=189901&view=rev
> Log:
> clang-cl: Avoid confusing diagnostics when clang-cl is called just cl.exe
>
> Modified:
> cfe/trunk/tools/driver/driver.cpp
>
> Modified: cfe/trunk/tools/driver/driver.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=189901&r1=189900&r2=189901&view=diff
>
> ==============================================================================
> --- cfe/trunk/tools/driver/driver.cpp (original)
> +++ cfe/trunk/tools/driver/driver.cpp Tue Sep 3 20:37:22 2013
> @@ -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";
>
Seems unfortunate to use a bogus (possibly non-existent) filename. Maybe
"clang cl.exe" so it looks less like we're claiming this was the executable
name?
Also, is it feasible to add a test for this?
> + DiagClient->setPrefix(ExeBasename);
> +
> IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
>
> DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagClient);
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130903/68f62fec/attachment.html>
More information about the cfe-commits
mailing list