summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-06-28 22:38:57 +0200
committerStephan Bergmann <sbergman@redhat.com>2016-06-28 22:38:57 +0200
commit0d3f9667bbc7b1a22d33dc92a2028fc712495a8e (patch)
tree0e47617932f5be3d6157f06e1bfeb6c53090cd09
parent0d3738a2580d72b778547bfcdf691fdeb0eccbdd (diff)
AllocatorTraits::size can be static after all
Change-Id: If9ce8a094af878497e980cdcfaf11604d613e5b8
-rw-r--r--compilerplugins/clang/staticmethods.cxx5
-rw-r--r--sal/cpprt/operators_new_delete.cxx4
2 files changed, 2 insertions, 7 deletions
diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx
index 7eac313d1218..c53324275ed9 100644
--- a/compilerplugins/clang/staticmethods.cxx
+++ b/compilerplugins/clang/staticmethods.cxx
@@ -117,12 +117,7 @@ bool StaticMethods::TraverseCXXMethodDecl(const CXXMethodDecl * pCXXMethodDecl)
if (aParentName == "BitmapInfoAccess") {
return true;
}
- // can't change it because in debug mode it can't be static
- // sal/cpprt/operators_new_delete.cxx
auto dc = loplugin::DeclCheck(pCXXMethodDecl->getParent());
- if (dc.Struct("AllocatorTraits").AnonymousNamespace().GlobalNamespace()) {
- return true;
- }
// in this case, the code is taking the address of the member function
// shell/source/unix/sysshell/recently_used_file_handler.cxx
if (dc.Struct("recently_used_item").AnonymousNamespace().GlobalNamespace())
diff --git a/sal/cpprt/operators_new_delete.cxx b/sal/cpprt/operators_new_delete.cxx
index 8cf69ff07196..40fdd330302e 100644
--- a/sal/cpprt/operators_new_delete.cxx
+++ b/sal/cpprt/operators_new_delete.cxx
@@ -40,7 +40,7 @@ struct AllocatorTraits
: m_signature (s)
{}
- std::size_t size (std::size_t n) const
+ static std::size_t size (std::size_t n)
{
n = std::max(n, std::size_t(1));
#if OSL_DEBUG_LEVEL > 0
@@ -105,7 +105,7 @@ static void default_handler()
static void* allocate (
std::size_t n, AllocatorTraits const & rTraits)
{
- n = rTraits.size (n);
+ n = AllocatorTraits::size (n);
for (;;)
{
void * p = rtl_allocateMemory (sal_Size(n));