Skip to content

Commit 42662c2

Browse files
authored
[lld] Initialize SingleStringMatcher::ExactMatch (#123138)
It was not set false in all branches.
1 parent fadb0e9 commit 42662c2

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lld/Common/Strings.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,21 @@
1919
using namespace llvm;
2020
using namespace lld;
2121

22-
SingleStringMatcher::SingleStringMatcher(StringRef Pattern) {
23-
if (Pattern.size() > 2 && Pattern.starts_with("\"") &&
24-
Pattern.ends_with("\"")) {
25-
ExactMatch = true;
22+
static bool isExact(StringRef Pattern) {
23+
return Pattern.size() > 2 && Pattern.starts_with("\"") &&
24+
Pattern.ends_with("\"");
25+
}
26+
27+
SingleStringMatcher::SingleStringMatcher(StringRef Pattern)
28+
: ExactMatch(isExact(Pattern)) {
29+
if (ExactMatch) {
2630
ExactPattern = Pattern.substr(1, Pattern.size() - 2);
2731
} else {
2832
Expected<GlobPattern> Glob = GlobPattern::create(Pattern);
2933
if (!Glob) {
3034
error(toString(Glob.takeError()) + ": " + Pattern);
3135
return;
3236
}
33-
ExactMatch = false;
3437
GlobPatternMatcher = *Glob;
3538
}
3639
}

0 commit comments

Comments
 (0)