-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lld] Initialize SingleStringMatcher::ExactMatch #123138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lld] Initialize SingleStringMatcher::ExactMatch #123138
Conversation
Created using spr 1.3.4
@llvm/pr-subscribers-objectyaml @llvm/pr-subscribers-lld Author: Vitaly Buka (vitalybuka) ChangesIt was not set false in all branches. Full diff: https://github.com/llvm/llvm-project/pull/123138.diff 1 Files Affected:
diff --git a/lld/Common/Strings.cpp b/lld/Common/Strings.cpp
index 41cbbf36f38cb0..8e1a8ce212878f 100644
--- a/lld/Common/Strings.cpp
+++ b/lld/Common/Strings.cpp
@@ -19,10 +19,13 @@
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 +33,6 @@ SingleStringMatcher::SingleStringMatcher(StringRef Pattern) {
error(toString(Glob.takeError()) + ": " + Pattern);
return;
}
- ExactMatch = false;
GlobPatternMatcher = *Glob;
}
}
|
@llvm/pr-subscribers-lld-elf Author: Vitaly Buka (vitalybuka) ChangesIt was not set false in all branches. Full diff: https://github.com/llvm/llvm-project/pull/123138.diff 1 Files Affected:
diff --git a/lld/Common/Strings.cpp b/lld/Common/Strings.cpp
index 41cbbf36f38cb0..8e1a8ce212878f 100644
--- a/lld/Common/Strings.cpp
+++ b/lld/Common/Strings.cpp
@@ -19,10 +19,13 @@
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 +33,6 @@ SingleStringMatcher::SingleStringMatcher(StringRef Pattern) {
error(toString(Glob.takeError()) + ": " + Pattern);
return;
}
- ExactMatch = false;
GlobPatternMatcher = *Glob;
}
}
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Created using spr 1.3.4 [skip ci]
It was not set false in all branches.