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/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index cb4d61c..325a306 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -587,7 +587,7 @@
continue;
if (Message)
- ResultMessage = Deprecated->getMessage();
+ ResultMessage = std::string(Deprecated->getMessage());
Result = AR_Deprecated;
continue;
@@ -595,7 +595,7 @@
if (const auto *Unavailable = dyn_cast<UnavailableAttr>(A)) {
if (Message)
- *Message = Unavailable->getMessage();
+ *Message = std::string(Unavailable->getMessage());
return AR_Unavailable;
}