summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2019-08-02 05:04:27 +0000
committerRui Ueyama <ruiu@google.com>2019-08-02 05:04:27 +0000
commit96a7a225f5f99b1145687dc678c08663bd3b9370 (patch)
tree0ae268dce207277b0db587ac4a1cbc5edbf79704
parenta52f982f1cd98ebf94abb5deb5244f460ddad2d1 (diff)
downloadbcm5719-llvm-96a7a225f5f99b1145687dc678c08663bd3b9370.tar.gz
bcm5719-llvm-96a7a225f5f99b1145687dc678c08663bd3b9370.zip
Add a comment for --vs-diagnostics.
llvm-svn: 367650
-rw-r--r--lld/Common/ErrorHandler.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lld/Common/ErrorHandler.cpp b/lld/Common/ErrorHandler.cpp
index 592b5b508da..f22de2531f9 100644
--- a/lld/Common/ErrorHandler.cpp
+++ b/lld/Common/ErrorHandler.cpp
@@ -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;
OpenPOWER on IntegriCloud