r189901 - clang-cl: Avoid confusing diagnostics when clang-cl is called just cl.exe
Reid Kleckner
rnk at google.com
Tue Sep 3 20:13:26 PDT 2013
On Tue, Sep 3, 2013 at 6:46 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> 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?
>
Sounds good, r189909.
> Also, is it feasible to add a test for this?
>
A symlink on *nix would suffice, but on Windows it would require a stub to
call CreateProcess on an executable with a modified argv[0] value. It
didn't seem worth it.
>
>
>> + 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
>>
>
>
> _______________________________________________
> 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/1f889389/attachment.html>
More information about the cfe-commits
mailing list