diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-04-14 06:42:56 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-04-14 06:42:56 +0000 |
commit | 1cc9023e7ff9abc8e989a2acac59203d0d564b5a (patch) | |
tree | bab6270e9415c274065392ceca622ed1d19672da | |
parent | a2d4d6b4592743305cd1b64a2d9fe895f96f18bb (diff) | |
download | bcm5719-llvm-1cc9023e7ff9abc8e989a2acac59203d0d564b5a.tar.gz bcm5719-llvm-1cc9023e7ff9abc8e989a2acac59203d0d564b5a.zip |
[Allocator] Hoist the external helper function into a namespace scope
declaration. GCC 4.7 appears to get hopelessly confused by declaring
this function within a member function of a class template. Go figure.
llvm-svn: 206152
-rw-r--r-- | llvm/include/llvm/Support/Allocator.h | 16 | ||||
-rw-r--r-- | llvm/lib/Support/Allocator.cpp | 4 |
2 files changed, 14 insertions, 6 deletions
diff --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h index 4a5e1b32a50..19ef4e834a5 100644 --- a/llvm/include/llvm/Support/Allocator.h +++ b/llvm/include/llvm/Support/Allocator.h @@ -67,6 +67,14 @@ public: void Deallocate(void *Slab, size_t Size) { Allocator.Deallocate(Slab); } }; +namespace detail { + +// We call out to an external function to actually print the message as the +// printing code uses Allocator.h in its implementation. +void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated, + size_t TotalMemory); +} // End namespace detail. + /// \brief Allocate memory in an ever growing pool, as if by bump-pointer. /// /// This isn't strictly a bump-pointer allocator as it uses backing slabs of @@ -200,12 +208,8 @@ public: } void PrintStats() const { - // We call out to an external function to actually print the message as the - // printing code uses Allocator.h in its implementation. - extern void printBumpPtrAllocatorStats( - unsigned NumSlabs, size_t BytesAllocated, size_t TotalMemory); - - printBumpPtrAllocatorStats(Slabs.size(), BytesAllocated, getTotalMemory()); + detail::printBumpPtrAllocatorStats(Slabs.size(), BytesAllocated, + getTotalMemory()); } private: diff --git a/llvm/lib/Support/Allocator.cpp b/llvm/lib/Support/Allocator.cpp index ae861c8c4b6..7c306b2370e 100644 --- a/llvm/lib/Support/Allocator.cpp +++ b/llvm/lib/Support/Allocator.cpp @@ -21,6 +21,8 @@ namespace llvm { +namespace detail { + void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated, size_t TotalMemory) { errs() << "\nNumber of memory regions: " << NumSlabs << '\n' @@ -30,6 +32,8 @@ void printBumpPtrAllocatorStats(unsigned NumSlabs, size_t BytesAllocated, << " (includes alignment, etc)\n"; } +} // End namespace detail. + void PrintRecyclerStats(size_t Size, size_t Align, size_t FreeListSize) { |