[lld] r367650 - Add a comment for --vs-diagnostics.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 1 22:04:27 PDT 2019
Author: ruiu
Date: Thu Aug 1 22:04:27 2019
New Revision: 367650
URL: http://llvm.org/viewvc/llvm-project?rev=367650&view=rev
Log:
Add a comment for --vs-diagnostics.
Modified:
lld/trunk/Common/ErrorHandler.cpp
Modified: lld/trunk/Common/ErrorHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/Common/ErrorHandler.cpp?rev=367650&r1=367649&r2=367650&view=diff
==============================================================================
--- lld/trunk/Common/ErrorHandler.cpp (original)
+++ lld/trunk/Common/ErrorHandler.cpp Thu Aug 1 22:04:27 2019
@@ -85,6 +85,27 @@ void lld::checkError(Error e) {
[&](ErrorInfoBase &eib) { error(eib.message()); });
}
+// This is for --vs-diagnostics.
+//
+// Normally, lld's error message starts with argv[0]. Therefore, it usually
+// looks like this:
+//
+// ld.lld: error: ...
+//
+// This error message style is unfortunately unfriendly to Visual Studio
+// IDE. VS interprets the first word of the first line as an error location
+// and make it clickable, thus "ld.lld" in the above message would become a
+// clickable text. When you click it, VS opens "ld.lld" executable file with
+// a binary editor.
+//
+// As a workaround, we print out an error location instead of "ld.lld" if
+// lld is running in VS diagnostics mode. As a result, error message will
+// look like this:
+//
+// src/foo.c(35): error: ...
+//
+// This function returns an error location string. An error location is
+// extracted from an error message using regexps.
std::string ErrorHandler::getLocation(const Twine &msg) {
if (!vsDiagnostics)
return logName;
More information about the llvm-commits
mailing list