Make llvm::StringRef to std::string conversions explicit.
This is how it should've been and brings it more in line with
std::string_view. There should be no functional change here.
This is mostly mechanical from a custom clang-tidy check, with a lot of
manual fixups. It uncovers a lot of minor inefficiencies.
This doesn't actually modify StringRef yet, I'll do that in a follow-up.
diff --git a/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
index e49688b..9347dac 100644
--- a/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
@@ -652,9 +652,10 @@
anyOf(DestUnknownDecl, hasDescendant(DestUnknownDecl))));
auto NullTerminatorExpr = binaryOperator(
- hasLHS(anyOf(hasDescendant(declRefExpr(
- to(varDecl(equalsBoundNode(DestVarDeclName))))),
- hasDescendant(declRefExpr(equalsBoundNode(DestExprName))))),
+ hasLHS(anyOf(hasDescendant(declRefExpr(to(varDecl(
+ equalsBoundNode(std::string(DestVarDeclName)))))),
+ hasDescendant(declRefExpr(
+ equalsBoundNode(std::string(DestExprName)))))),
hasRHS(ignoringImpCasts(
anyOf(characterLiteral(equals(0U)), integerLiteral(equals(0))))));