projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
96a7a22
)
Add an assert() to catch possible regexp errors.
author
Rui Ueyama
<ruiu@google.com>
Fri, 2 Aug 2019 05:11:19 +0000
(
05:11
+0000)
committer
Rui Ueyama
<ruiu@google.com>
Fri, 2 Aug 2019 05:11:19 +0000
(
05:11
+0000)
llvm-svn: 367651
lld/Common/ErrorHandler.cpp
patch
|
blob
|
history
diff --git
a/lld/Common/ErrorHandler.cpp
b/lld/Common/ErrorHandler.cpp
index
f22de25
..
a012afc
100644
(file)
--- 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 m
atch
;
- if (!std::regex_search(str, m
atch
, re))
+ std::smatch m;
+ if (!std::regex_search(str, m, re))
continue;
+ assert(m.size() == 2 || m.size() == 3);
- if (m
atch.size() >
2)
- return m
atch.str(1) + "(" + match.str(2) + ")"
;
- return m
atch.str(1)
;
+ if (m
.size() ==
2)
+ return m
.str(1)
;
+ return m
.str(1) + "(" + m.str(2) + ")"
;
}
return logName;