diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-02-13 08:30:43 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-02-13 11:24:43 +0100 |
commit | 38dcd3bc735633f2a4857849ef14917bbffcdd11 (patch) | |
tree | 98dcde5a1cacde29b33d563a3aece3fc746e4c5b /compilerplugins/clang/useuniqueptr.cxx | |
parent | Prefer array over vector for 3 elements container (diff) | |
download | core-38dcd3bc735633f2a4857849ef14917bbffcdd11.tar.gz core-38dcd3bc735633f2a4857849ef14917bbffcdd11.zip |
Get rid of some unnecessary llvm::StringRef -> std::string conversions
(as discussed in the commit message of ce1d8e20a708ed031f2336770a41fbe501fe8225
"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>
Diffstat (limited to 'compilerplugins/clang/useuniqueptr.cxx')
-rw-r--r-- | compilerplugins/clang/useuniqueptr.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx index d0156cac44bb..564e81c442e7 100644 --- a/compilerplugins/clang/useuniqueptr.cxx +++ b/compilerplugins/clang/useuniqueptr.cxx @@ -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") |