summaryrefslogtreecommitdiff
path: root/lld
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2023-05-16 10:12:42 -0700
committerKazu Hirata <kazu@google.com>2023-05-16 10:12:42 -0700
commited1539c6ad3d2c6e888985d21f841504f69beab3 (patch)
treeb66a52d786b827ac64042e38cdf8bc14688dfc21 /lld
parent4107898839c37bc7e5501fc313282d40719b0bc6 (diff)
downloadllvm-ed1539c6ad3d2c6e888985d21f841504f69beab3.tar.gz
Migrate {starts,ends}with_insensitive to {starts,ends}_with_insensitive (NFC)
This patch migrates uses of StringRef::{starts,ends}with_insensitive to StringRef::{starts,ends}_with_insensitive so that we can use names similar to those used in std::string_view. Note that the llvm/ directory has migrated in commit 6c3ea866e93003e16fc55d3b5cedd3bc371d1fde. I'll post a separate patch to deprecate StringRef::{starts,ends}with_insensitive. Differential Revision: https://reviews.llvm.org/D150506
Diffstat (limited to 'lld')
-rw-r--r--lld/COFF/Driver.cpp4
-rw-r--r--lld/COFF/DriverUtils.cpp20
-rw-r--r--lld/Common/Args.cpp2
-rw-r--r--lld/ELF/ScriptParser.cpp8
-rw-r--r--lld/MinGW/Driver.cpp2
-rw-r--r--lld/tools/lld/lld.cpp2
6 files changed, 19 insertions, 19 deletions
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 6326e466930a..6d0b3494b6af 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -230,7 +230,7 @@ void LinkerDriver::addBuffer(std::unique_ptr<MemoryBuffer> mb,
ctx.symtab.addFile(make<DLLFile>(ctx, mbref));
break;
}
- if (filename.endswith_insensitive(".dll")) {
+ if (filename.ends_with_insensitive(".dll")) {
error(filename + ": bad file type. Did you specify a DLL instead of an "
"import library?");
break;
@@ -503,7 +503,7 @@ std::optional<StringRef> LinkerDriver::findFile(StringRef filename) {
return std::nullopt;
}
- if (path.endswith_insensitive(".lib"))
+ if (path.ends_with_insensitive(".lib"))
visitedLibs.insert(std::string(sys::path::filename(path).lower()));
return path;
}
diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp
index c663a85f43cf..e09bb7421547 100644
--- a/lld/COFF/DriverUtils.cpp
+++ b/lld/COFF/DriverUtils.cpp
@@ -270,13 +270,13 @@ void LinkerDriver::parseManifest(StringRef arg) {
ctx.config.manifest = Configuration::No;
return;
}
- if (!arg.startswith_insensitive("embed"))
+ if (!arg.starts_with_insensitive("embed"))
fatal("invalid option " + arg);
ctx.config.manifest = Configuration::Embed;
arg = arg.substr(strlen("embed"));
if (arg.empty())
return;
- if (!arg.startswith_insensitive(",id="))
+ if (!arg.starts_with_insensitive(",id="))
fatal("invalid option " + arg);
arg = arg.substr(strlen(",id="));
if (arg.getAsInteger(0, ctx.config.manifestID))
@@ -294,12 +294,12 @@ void LinkerDriver::parseManifestUAC(StringRef arg) {
arg = arg.ltrim();
if (arg.empty())
return;
- if (arg.startswith_insensitive("level=")) {
+ if (arg.starts_with_insensitive("level=")) {
arg = arg.substr(strlen("level="));
std::tie(ctx.config.manifestLevel, arg) = arg.split(" ");
continue;
}
- if (arg.startswith_insensitive("uiaccess=")) {
+ if (arg.starts_with_insensitive("uiaccess=")) {
arg = arg.substr(strlen("uiaccess="));
std::tie(ctx.config.manifestUIAccess, arg) = arg.split(" ");
continue;
@@ -904,14 +904,14 @@ ParsedDirectives ArgParser::parseDirectives(StringRef s) {
SmallVector<StringRef, 16> tokens;
cl::TokenizeWindowsCommandLineNoCopy(s, saver(), tokens);
for (StringRef tok : tokens) {
- if (tok.startswith_insensitive("/export:") ||
- tok.startswith_insensitive("-export:"))
+ if (tok.starts_with_insensitive("/export:") ||
+ tok.starts_with_insensitive("-export:"))
result.exports.push_back(tok.substr(strlen("/export:")));
- else if (tok.startswith_insensitive("/include:") ||
- tok.startswith_insensitive("-include:"))
+ else if (tok.starts_with_insensitive("/include:") ||
+ tok.starts_with_insensitive("-include:"))
result.includes.push_back(tok.substr(strlen("/include:")));
- else if (tok.startswith_insensitive("/exclude-symbols:") ||
- tok.startswith_insensitive("-exclude-symbols:"))
+ else if (tok.starts_with_insensitive("/exclude-symbols:") ||
+ tok.starts_with_insensitive("-exclude-symbols:"))
result.excludes.push_back(tok.substr(strlen("/exclude-symbols:")));
else {
// Copy substrings that are not valid C strings. The tokenizer may have
diff --git a/lld/Common/Args.cpp b/lld/Common/Args.cpp
index b6d050bb1f77..d0249fef856f 100644
--- a/lld/Common/Args.cpp
+++ b/lld/Common/Args.cpp
@@ -87,7 +87,7 @@ std::vector<StringRef> lld::args::getLines(MemoryBufferRef mb) {
}
StringRef lld::args::getFilenameWithoutExe(StringRef path) {
- if (path.endswith_insensitive(".exe"))
+ if (path.ends_with_insensitive(".exe"))
return sys::path::stem(path);
return sys::path::filename(path);
}
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp
index 396d27d9357a..dea5ce6435e2 100644
--- a/lld/ELF/ScriptParser.cpp
+++ b/lld/ELF/ScriptParser.cpp
@@ -1228,24 +1228,24 @@ Expr ScriptParser::readConstant() {
static std::optional<uint64_t> parseInt(StringRef tok) {
// Hexadecimal
uint64_t val;
- if (tok.startswith_insensitive("0x")) {
+ if (tok.starts_with_insensitive("0x")) {
if (!to_integer(tok.substr(2), val, 16))
return std::nullopt;
return val;
}
- if (tok.endswith_insensitive("H")) {
+ if (tok.ends_with_insensitive("H")) {
if (!to_integer(tok.drop_back(), val, 16))
return std::nullopt;
return val;
}
// Decimal
- if (tok.endswith_insensitive("K")) {
+ if (tok.ends_with_insensitive("K")) {
if (!to_integer(tok.drop_back(), val, 10))
return std::nullopt;
return val * 1024;
}
- if (tok.endswith_insensitive("M")) {
+ if (tok.ends_with_insensitive("M")) {
if (!to_integer(tok.drop_back(), val, 10))
return std::nullopt;
return val * 1024 * 1024;
diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp
index 8f271ba40d02..f00f50a76e31 100644
--- a/lld/MinGW/Driver.cpp
+++ b/lld/MinGW/Driver.cpp
@@ -437,7 +437,7 @@ bool mingw::link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
for (auto *a : args) {
switch (a->getOption().getID()) {
case OPT_INPUT:
- if (StringRef(a->getValue()).endswith_insensitive(".def"))
+ if (StringRef(a->getValue()).ends_with_insensitive(".def"))
add("-def:" + StringRef(a->getValue()));
else
add(prefix + StringRef(a->getValue()));
diff --git a/lld/tools/lld/lld.cpp b/lld/tools/lld/lld.cpp
index 292fd9d0f9c6..2fc9c3a66914 100644
--- a/lld/tools/lld/lld.cpp
+++ b/lld/tools/lld/lld.cpp
@@ -136,7 +136,7 @@ static Flavor parseFlavor(std::vector<const char *> &v) {
// Deduct the flavor from argv[0].
StringRef arg0 = path::filename(v[0]);
- if (arg0.endswith_insensitive(".exe"))
+ if (arg0.ends_with_insensitive(".exe"))
arg0 = arg0.drop_back(4);
return parseProgname(arg0);
}