<div dir="ltr">On Tue, Sep 3, 2013 at 6:46 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div class="h5">On Tue, Sep 3, 2013 at 6:37 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:reid@kleckner.net" target="_blank">reid@kleckner.net</a>></span> wrote:<br>
</div></div><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: rnk<br>
Date: Tue Sep 3 20:37:22 2013<br>
New Revision: 189901<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=189901&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=189901&view=rev</a><br>
Log:<br>
clang-cl: Avoid confusing diagnostics when clang-cl is called just cl.exe<br>
<br>
Modified:<br>
cfe/trunk/tools/driver/driver.cpp<br>
<br>
Modified: cfe/trunk/tools/driver/driver.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=189901&r1=189900&r2=189901&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=189901&r1=189900&r2=189901&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/tools/driver/driver.cpp (original)<br>
+++ cfe/trunk/tools/driver/driver.cpp Tue Sep 3 20:37:22 2013<br>
@@ -346,7 +346,14 @@ int main(int argc_, const char **argv_)<br>
// DiagnosticOptions instance.<br>
TextDiagnosticPrinter *DiagClient<br>
= new TextDiagnosticPrinter(llvm::errs(), &*DiagOpts);<br>
- DiagClient->setPrefix(llvm::sys::path::filename(Path));<br>
+<br>
+ // If the clang binary happens to be named cl.exe for compatibility reasons,<br>
+ // use clang-cl.exe as the prefix to avoid confusion between clang and MSVC.<br>
+ StringRef ExeBasename(llvm::sys::path::filename(Path));<br>
+ if (ExeBasename.trim().equals_lower("cl.exe"))<br>
+ ExeBasename = "clang-cl.exe";<br></blockquote><div><br></div></div></div><div>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?</div>
</div></div></div></blockquote><div><br></div><div>Sounds good, r189909.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Also, is it feasible to add a test for this?</div></div></div></div></blockquote><div><br></div><div>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.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div><span style="color:rgb(80,0,80)"> </span></div><div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+ DiagClient->setPrefix(ExeBasename);<br>
+<br>
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());<br>
<br>
DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagClient);<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div><br></div></div>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div></div>