[clang] [llvm] [mlir] Use StringRef::find_first_of(char), etc (NFC) (PR #92841)
https://github.com/kazutakahirata closed https://github.com/llvm/llvm-project/pull/92841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] Use StringRef::find_first_of(char), etc (NFC) (PR #92841)
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/92841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] Use StringRef::find_first_of(char), etc (NFC) (PR #92841)
llvmbot wrote: @llvm/pr-subscribers-llvm-support Author: Kazu Hirata (kazutakahirata) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/92841.diff 4 Files Affected: - (modified) clang/utils/TableGen/ClangDiagnosticsEmitter.cpp (+1-1) - (modified) llvm/lib/Support/LockFileManager.cpp (+1-1) - (modified) llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp (+2-2) - (modified) mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp (+1-1) ``diff diff --git a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp index 4512acfd19a1b..f564689fff7cf 100644 --- a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp +++ b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -1086,7 +1086,7 @@ Piece *DiagnosticTextBuilder::DiagText::parseDiagText(StringRef , PluralPiece *Plural = New(); do { Text = Text.drop_front(); // '{' or '|' -size_t End = Text.find_first_of(":"); +size_t End = Text.find_first_of(':'); if (End == StringRef::npos) Builder.PrintFatalError("expected ':' while parsing %plural"); ++End; diff --git a/llvm/lib/Support/LockFileManager.cpp b/llvm/lib/Support/LockFileManager.cpp index 083f8d7b37be3..3169aa25ec0d9 100644 --- a/llvm/lib/Support/LockFileManager.cpp +++ b/llvm/lib/Support/LockFileManager.cpp @@ -66,7 +66,7 @@ LockFileManager::readLockFile(StringRef LockFileName) { StringRef Hostname; StringRef PIDStr; std::tie(Hostname, PIDStr) = getToken(MB.getBuffer(), " "); - PIDStr = PIDStr.substr(PIDStr.find_first_not_of(" ")); + PIDStr = PIDStr.substr(PIDStr.find_first_not_of(' ')); int PID; if (!PIDStr.getAsInteger(10, PID)) { auto Owner = std::make_pair(std::string(Hostname), PID); diff --git a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp index 4cb76f4347422..06ac98b0c5e13 100644 --- a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -649,9 +649,9 @@ void applySpecificSectionMappings(RuntimeDyld , const FileToSectionIDMap ) { for (StringRef Mapping : SpecificSectionMappings) { -size_t EqualsIdx = Mapping.find_first_of("="); +size_t EqualsIdx = Mapping.find_first_of('='); std::string SectionIDStr = std::string(Mapping.substr(0, EqualsIdx)); -size_t ComaIdx = Mapping.find_first_of(","); +size_t ComaIdx = Mapping.find_first_of(','); if (ComaIdx == StringRef::npos) report_fatal_error("Invalid section specification '" + Mapping + diff --git a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp index ed75b4a90536e..4e19274c3da40 100644 --- a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp +++ b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp @@ -917,7 +917,7 @@ void MLIRDocument::getCodeActionForDiagnostic( edit.range = lsp::Range(lsp::Position(pos.line, 0)); // Use the indent of the current line for the expected-* diagnostic. - size_t indent = line.find_first_not_of(" "); + size_t indent = line.find_first_not_of(' '); if (indent == StringRef::npos) indent = line.size(); `` https://github.com/llvm/llvm-project/pull/92841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] Use StringRef::find_first_of(char), etc (NFC) (PR #92841)
llvmbot wrote: @llvm/pr-subscribers-mlir-core Author: Kazu Hirata (kazutakahirata) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/92841.diff 4 Files Affected: - (modified) clang/utils/TableGen/ClangDiagnosticsEmitter.cpp (+1-1) - (modified) llvm/lib/Support/LockFileManager.cpp (+1-1) - (modified) llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp (+2-2) - (modified) mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp (+1-1) ``diff diff --git a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp index 4512acfd19a1b..f564689fff7cf 100644 --- a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp +++ b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -1086,7 +1086,7 @@ Piece *DiagnosticTextBuilder::DiagText::parseDiagText(StringRef , PluralPiece *Plural = New(); do { Text = Text.drop_front(); // '{' or '|' -size_t End = Text.find_first_of(":"); +size_t End = Text.find_first_of(':'); if (End == StringRef::npos) Builder.PrintFatalError("expected ':' while parsing %plural"); ++End; diff --git a/llvm/lib/Support/LockFileManager.cpp b/llvm/lib/Support/LockFileManager.cpp index 083f8d7b37be3..3169aa25ec0d9 100644 --- a/llvm/lib/Support/LockFileManager.cpp +++ b/llvm/lib/Support/LockFileManager.cpp @@ -66,7 +66,7 @@ LockFileManager::readLockFile(StringRef LockFileName) { StringRef Hostname; StringRef PIDStr; std::tie(Hostname, PIDStr) = getToken(MB.getBuffer(), " "); - PIDStr = PIDStr.substr(PIDStr.find_first_not_of(" ")); + PIDStr = PIDStr.substr(PIDStr.find_first_not_of(' ')); int PID; if (!PIDStr.getAsInteger(10, PID)) { auto Owner = std::make_pair(std::string(Hostname), PID); diff --git a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp index 4cb76f4347422..06ac98b0c5e13 100644 --- a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -649,9 +649,9 @@ void applySpecificSectionMappings(RuntimeDyld , const FileToSectionIDMap ) { for (StringRef Mapping : SpecificSectionMappings) { -size_t EqualsIdx = Mapping.find_first_of("="); +size_t EqualsIdx = Mapping.find_first_of('='); std::string SectionIDStr = std::string(Mapping.substr(0, EqualsIdx)); -size_t ComaIdx = Mapping.find_first_of(","); +size_t ComaIdx = Mapping.find_first_of(','); if (ComaIdx == StringRef::npos) report_fatal_error("Invalid section specification '" + Mapping + diff --git a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp index ed75b4a90536e..4e19274c3da40 100644 --- a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp +++ b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp @@ -917,7 +917,7 @@ void MLIRDocument::getCodeActionForDiagnostic( edit.range = lsp::Range(lsp::Position(pos.line, 0)); // Use the indent of the current line for the expected-* diagnostic. - size_t indent = line.find_first_not_of(" "); + size_t indent = line.find_first_not_of(' '); if (indent == StringRef::npos) indent = line.size(); `` https://github.com/llvm/llvm-project/pull/92841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] Use StringRef::find_first_of(char), etc (NFC) (PR #92841)
https://github.com/kazutakahirata edited https://github.com/llvm/llvm-project/pull/92841 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [llvm] [mlir] Use StringRef::find_first_of(char), etc (NFC) (PR #92841)
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/92841 etc (NFC), >From 4711f9f61fd35f3388f665a396f95951ee4b3f5b Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 20 May 2024 09:10:04 -0700 Subject: [PATCH] Use StringRef::find_first_of(char), etc (NFC) --- clang/utils/TableGen/ClangDiagnosticsEmitter.cpp | 2 +- llvm/lib/Support/LockFileManager.cpp | 2 +- llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp | 4 ++-- mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp| 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp index 4512acfd19a1b..f564689fff7cf 100644 --- a/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp +++ b/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -1086,7 +1086,7 @@ Piece *DiagnosticTextBuilder::DiagText::parseDiagText(StringRef , PluralPiece *Plural = New(); do { Text = Text.drop_front(); // '{' or '|' -size_t End = Text.find_first_of(":"); +size_t End = Text.find_first_of(':'); if (End == StringRef::npos) Builder.PrintFatalError("expected ':' while parsing %plural"); ++End; diff --git a/llvm/lib/Support/LockFileManager.cpp b/llvm/lib/Support/LockFileManager.cpp index 083f8d7b37be3..3169aa25ec0d9 100644 --- a/llvm/lib/Support/LockFileManager.cpp +++ b/llvm/lib/Support/LockFileManager.cpp @@ -66,7 +66,7 @@ LockFileManager::readLockFile(StringRef LockFileName) { StringRef Hostname; StringRef PIDStr; std::tie(Hostname, PIDStr) = getToken(MB.getBuffer(), " "); - PIDStr = PIDStr.substr(PIDStr.find_first_not_of(" ")); + PIDStr = PIDStr.substr(PIDStr.find_first_not_of(' ')); int PID; if (!PIDStr.getAsInteger(10, PID)) { auto Owner = std::make_pair(std::string(Hostname), PID); diff --git a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp index 4cb76f4347422..06ac98b0c5e13 100644 --- a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -649,9 +649,9 @@ void applySpecificSectionMappings(RuntimeDyld , const FileToSectionIDMap ) { for (StringRef Mapping : SpecificSectionMappings) { -size_t EqualsIdx = Mapping.find_first_of("="); +size_t EqualsIdx = Mapping.find_first_of('='); std::string SectionIDStr = std::string(Mapping.substr(0, EqualsIdx)); -size_t ComaIdx = Mapping.find_first_of(","); +size_t ComaIdx = Mapping.find_first_of(','); if (ComaIdx == StringRef::npos) report_fatal_error("Invalid section specification '" + Mapping + diff --git a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp index ed75b4a90536e..4e19274c3da40 100644 --- a/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp +++ b/mlir/lib/Tools/mlir-lsp-server/MLIRServer.cpp @@ -917,7 +917,7 @@ void MLIRDocument::getCodeActionForDiagnostic( edit.range = lsp::Range(lsp::Position(pos.line, 0)); // Use the indent of the current line for the expected-* diagnostic. - size_t indent = line.find_first_not_of(" "); + size_t indent = line.find_first_not_of(' '); if (indent == StringRef::npos) indent = line.size(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits