[Mlir-commits] [mlir] 33b5158 - Replace usage of StringRef::find_last_of with a string literal of size one by the equivalent char literal
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Nov 15 06:03:33 PST 2023
Author: serge-sans-paille
Date: 2023-11-15T15:01:36+01:00
New Revision: 33b51588c5d51995909f1f0be0b47b1708dac4fa
URL: https://github.com/llvm/llvm-project/commit/33b51588c5d51995909f1f0be0b47b1708dac4fa
DIFF: https://github.com/llvm/llvm-project/commit/33b51588c5d51995909f1f0be0b47b1708dac4fa.diff
LOG: Replace usage of StringRef::find_last_of with a string literal of size one by the equivalent char literal
Added:
Modified:
clang/lib/Driver/ToolChains/ZOS.cpp
llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
mlir/lib/Tools/lsp-server-support/SourceMgrUtils.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/ZOS.cpp b/clang/lib/Driver/ToolChains/ZOS.cpp
index a7d6f030f3850a5..96dbf602e7c1fc9 100644
--- a/clang/lib/Driver/ToolChains/ZOS.cpp
+++ b/clang/lib/Driver/ToolChains/ZOS.cpp
@@ -143,7 +143,7 @@ void zos::Linker::ConstructJob(Compilation &C, const JobAction &JA,
StringRef OutputName = Output.getFilename();
// Strip away the last file suffix in presence from output name and add
// a new .x suffix.
- size_t Suffix = OutputName.find_last_of(".");
+ size_t Suffix = OutputName.find_last_of('.');
const char *SideDeckName =
Args.MakeArgString(OutputName.substr(0, Suffix) + ".x");
CmdArgs.push_back("-x");
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
index d03820f5f9e6c93..7b5dc3795b0227f 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp
@@ -102,7 +102,7 @@ void AMDGPUPrintfRuntimeBindingImpl::getConversionSpecifiers(
bool ArgDump = false;
StringRef CurFmt = Fmt.substr(PrevFmtSpecifierIdx,
CurFmtSpecifierIdx - PrevFmtSpecifierIdx);
- size_t pTag = CurFmt.find_last_of("%");
+ size_t pTag = CurFmt.find_last_of('%');
if (pTag != StringRef::npos) {
ArgDump = true;
while (pTag && CurFmt[--pTag] == '%') {
diff --git a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
index d6354876b558744..ae9e801f8f50b84 100644
--- a/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
@@ -163,7 +163,7 @@ lookupBuiltin(StringRef DemangledCall,
// the information after angle brackets and return type removed.
if (BuiltinName.find('<') && BuiltinName.back() == '>') {
BuiltinName = BuiltinName.substr(0, BuiltinName.find('<'));
- BuiltinName = BuiltinName.substr(BuiltinName.find_last_of(" ") + 1);
+ BuiltinName = BuiltinName.substr(BuiltinName.find_last_of(' ') + 1);
}
// Check if the extracted name begins with "__spirv_ImageSampleExplicitLod"
diff --git a/mlir/lib/Tools/lsp-server-support/SourceMgrUtils.cpp b/mlir/lib/Tools/lsp-server-support/SourceMgrUtils.cpp
index fe668130d4e2dbc..b6f4f3cc1869edb 100644
--- a/mlir/lib/Tools/lsp-server-support/SourceMgrUtils.cpp
+++ b/mlir/lib/Tools/lsp-server-support/SourceMgrUtils.cpp
@@ -83,7 +83,7 @@ lsp::extractSourceDocComment(llvm::SourceMgr &sourceMgr, SMLoc loc) {
// Pop the last line from the buffer string.
auto popLastLine = [&]() -> std::optional<StringRef> {
- size_t newlineOffset = buffer.find_last_of("\n");
+ size_t newlineOffset = buffer.find_last_of('\n');
if (newlineOffset == StringRef::npos)
return std::nullopt;
StringRef lastLine = buffer.drop_front(newlineOffset).trim();
More information about the Mlir-commits
mailing list