Get rid of some unnecessary llvm::StringRef -> std::string conversions

(as discussed in the commit message of ce1d8e20a7
"Adapt to '[ADT] Make StringRef's std::string conversion operator explicit'";
there are more of those that cannot easily be dropped, though).

Change-Id: Ib2e223f7de96ad8859eab165daa759b480326c7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88582
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2020-02-13 08:30:43 +01:00
parent 03d2fa836e
commit 38dcd3bc73
4 changed files with 17 additions and 24 deletions

View File

@@ -296,12 +296,12 @@ void UseUniquePtr::CheckDeleteExpr(const FunctionDecl* functionDecl, const CXXDe
}
template<typename T>
bool any_equal(std::string const & needle, T first) {
bool any_equal(StringRef needle, T first) {
return needle == first;
}
template<typename T, typename... Args>
bool any_equal(std::string const & needle, T first, Args... args) {
bool any_equal(StringRef needle, T first, Args... args) {
return needle == first || any_equal(needle, args...);
}
@@ -500,18 +500,19 @@ void UseUniquePtr::CheckDeleteLocalVar(const FunctionDecl* functionDecl, const C
if (parentName == "ScBroadcastAreaSlot")
return;
// complicated
if (any_equal(parentName.str(), "SwFormatField", "FontPropertyBox", "SdFontPropertyBox",
if (any_equal(parentName, "SwFormatField", "FontPropertyBox", "SdFontPropertyBox",
"SwHTMLParser", "PDFWriterImpl", "SbiParser", "DictionaryList", "SwGlossaryHdl", "SwGlossaryGroupDlg"))
return;
// ok
if (any_equal(parentName.str(), "SbTreeListBox"))
if (any_equal(parentName, "SbTreeListBox"))
return;
if (functionDecl->getIdentifier())
{
std::string name = functionDecl->getName().str();
auto name = functionDecl->getName();
SmallString<256> buf;
if (!parentName.empty())
name = std::string(parentName) + "::" + name;
name = (parentName + "::" + name).toStringRef(buf);
// custom deleters
if (name == "Proxy_free" || name == "s_free" || name == "binuno_proxy_free")