[clang-tools-extra] 8ba103c - [clang-tidy][NFC] Fix readability-static-accessed-through-instance findings
Piotr Zegar via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 27 01:53:30 PDT 2023
Author: Piotr Zegar
Date: 2023-08-27T08:52:09Z
New Revision: 8ba103ca681670750e0929f74ab72870a871202f
URL: https://github.com/llvm/llvm-project/commit/8ba103ca681670750e0929f74ab72870a871202f
DIFF: https://github.com/llvm/llvm-project/commit/8ba103ca681670750e0929f74ab72870a871202f.diff
LOG: [clang-tidy][NFC] Fix readability-static-accessed-through-instance findings
Fix issues found by clang-tidy in clang-tidy source directory.
Added:
Modified:
clang-tools-extra/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp
clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.cpp
clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp b/clang-tools-extra/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp
index bda9b9ec34e638..74ef6e67f00f34 100644
--- a/clang-tools-extra/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp
+++ b/clang-tools-extra/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp
@@ -43,11 +43,11 @@ std::optional<std::string> makeCharacterLiteral(const StringLiteral *Literal,
// Now replace the " with '.
std::string::size_type Pos = Result.find_first_of('"');
- if (Pos == Result.npos)
+ if (Pos == std::string::npos)
return std::nullopt;
Result[Pos] = '\'';
Pos = Result.find_last_of('"');
- if (Pos == Result.npos)
+ if (Pos == std::string::npos)
return std::nullopt;
Result[Pos] = '\'';
return Result;
diff --git a/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.cpp b/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.cpp
index ca4f6ad409b08c..40ea915a332990 100644
--- a/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.cpp
@@ -27,12 +27,12 @@ std::optional<std::string> makeCharacterLiteral(const StringLiteral *Literal) {
}
// Now replace the " with '.
auto OpenPos = Result.find_first_of('"');
- if (OpenPos == Result.npos)
+ if (OpenPos == std::string::npos)
return std::nullopt;
Result[OpenPos] = '\'';
auto ClosePos = Result.find_last_of('"');
- if (ClosePos == Result.npos)
+ if (ClosePos == std::string::npos)
return std::nullopt;
Result[ClosePos] = '\'';
diff --git a/clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp b/clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
index 07cb07f053729b..89e0c89fa933ae 100644
--- a/clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
@@ -59,9 +59,9 @@ static StringRef negatedOperator(const BinaryOperator *BinOp) {
const BinaryOperatorKind Opcode = BinOp->getOpcode();
for (auto NegatableOp : Opposites) {
if (Opcode == NegatableOp.first)
- return BinOp->getOpcodeStr(NegatableOp.second);
+ return BinaryOperator::getOpcodeStr(NegatableOp.second);
if (Opcode == NegatableOp.second)
- return BinOp->getOpcodeStr(NegatableOp.first);
+ return BinaryOperator::getOpcodeStr(NegatableOp.first);
}
return {};
}
diff --git a/clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.cpp b/clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.cpp
index dcdbcd36cba3c6..a40433e38a041d 100644
--- a/clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/utils/TransformerClangTidyCheck.cpp
@@ -34,7 +34,7 @@ std::string escapeForDiagnostic(std::string ToEscape) {
// Optimize for the common case that the string does not contain `%` at the
// cost of an extra scan over the string in the slow case.
auto Pos = ToEscape.find('%');
- if (Pos == ToEscape.npos)
+ if (Pos == std::string::npos)
return ToEscape;
std::string Result;
More information about the cfe-commits
mailing list