summaryrefslogtreecommitdiffstats
path: root/lld/Common/ErrorHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/Common/ErrorHandler.cpp')
-rw-r--r--lld/Common/ErrorHandler.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lld/Common/ErrorHandler.cpp b/lld/Common/ErrorHandler.cpp
index f22de2531f9..a012afcd694 100644
--- a/lld/Common/ErrorHandler.cpp
+++ b/lld/Common/ErrorHandler.cpp
@@ -124,13 +124,14 @@ std::string ErrorHandler::getLocation(const Twine &msg) {
std::string str = msg.str();
for (std::regex &re : regexes) {
- std::smatch match;
- if (!std::regex_search(str, match, re))
+ std::smatch m;
+ if (!std::regex_search(str, m, re))
continue;
+ assert(m.size() == 2 || m.size() == 3);
- if (match.size() > 2)
- return match.str(1) + "(" + match.str(2) + ")";
- return match.str(1);
+ if (m.size() == 2)
+ return m.str(1);
+ return m.str(1) + "(" + m.str(2) + ")";
}
return logName;
OpenPOWER on IntegriCloud