[lld] 42662c2 - [lld] Initialize SingleStringMatcher::ExactMatch (#123138)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 16:19:39 PST 2025
Author: Vitaly Buka
Date: 2025-01-15T16:19:35-08:00
New Revision: 42662c290a547a8f31a08ac82deac5b0679dd3fd
URL: https://github.com/llvm/llvm-project/commit/42662c290a547a8f31a08ac82deac5b0679dd3fd
DIFF: https://github.com/llvm/llvm-project/commit/42662c290a547a8f31a08ac82deac5b0679dd3fd.diff
LOG: [lld] Initialize SingleStringMatcher::ExactMatch (#123138)
It was not set false in all branches.
Added:
Modified:
lld/Common/Strings.cpp
Removed:
################################################################################
diff --git a/lld/Common/Strings.cpp b/lld/Common/Strings.cpp
index 41cbbf36f38cb0..58839e4afe5dbd 100644
--- a/lld/Common/Strings.cpp
+++ b/lld/Common/Strings.cpp
@@ -19,10 +19,14 @@
using namespace llvm;
using namespace lld;
-SingleStringMatcher::SingleStringMatcher(StringRef Pattern) {
- if (Pattern.size() > 2 && Pattern.starts_with("\"") &&
- Pattern.ends_with("\"")) {
- ExactMatch = true;
+static bool isExact(StringRef Pattern) {
+ return Pattern.size() > 2 && Pattern.starts_with("\"") &&
+ Pattern.ends_with("\"");
+}
+
+SingleStringMatcher::SingleStringMatcher(StringRef Pattern)
+ : ExactMatch(isExact(Pattern)) {
+ if (ExactMatch) {
ExactPattern = Pattern.substr(1, Pattern.size() - 2);
} else {
Expected<GlobPattern> Glob = GlobPattern::create(Pattern);
@@ -30,7 +34,6 @@ SingleStringMatcher::SingleStringMatcher(StringRef Pattern) {
error(toString(Glob.takeError()) + ": " + Pattern);
return;
}
- ExactMatch = false;
GlobPatternMatcher = *Glob;
}
}
More information about the llvm-commits
mailing list