Skip to content

Commit

Permalink
[clang-tidy][NFC] Fix readability-static-accessed-through-instance fi…
Browse files Browse the repository at this point in the history
…ndings

Fix issues found by clang-tidy in clang-tidy source directory.
  • Loading branch information
PiotrZSL committed Aug 27, 2023
1 parent f1f1633 commit 8ba103c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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] = '\'';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8ba103c

Please sign in to comment.