forked from OSchip/llvm-project
[demangler] Fix build breakage
The copy and pristine versions of Utility diverged and one didn't include <algorithm>. As that's a rather large header, let's just open code the comparisons. Reviewed By: Differential Revision: https://reviews.llvm.org/
This commit is contained in:
parent
5781839f7a
commit
fbf7bbcb83
|
@ -17,7 +17,6 @@
|
|||
#define DEMANGLE_UTILITY_H
|
||||
|
||||
#include "StringView.h"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
@ -40,8 +39,11 @@ class OutputBuffer {
|
|||
if (Need > BufferCapacity) {
|
||||
// Avoid many reallocations during startup, with a bit of hysteresis.
|
||||
constexpr size_t MinInitAlloc = 1024;
|
||||
Need = std::max(Need, MinInitAlloc);
|
||||
BufferCapacity = std::max(Need, BufferCapacity * 2);
|
||||
if (Need < MinInitAlloc)
|
||||
Need = MinInitAlloc;
|
||||
BufferCapacity *= 2;
|
||||
if (BufferCapacity < Need)
|
||||
BufferCapacity = Need;
|
||||
Buffer = static_cast<char *>(std::realloc(Buffer, BufferCapacity));
|
||||
if (Buffer == nullptr)
|
||||
std::terminate();
|
||||
|
|
|
@ -39,8 +39,11 @@ class OutputBuffer {
|
|||
if (Need > BufferCapacity) {
|
||||
// Avoid many reallocations during startup, with a bit of hysteresis.
|
||||
constexpr size_t MinInitAlloc = 1024;
|
||||
Need = std::max(Need, MinInitAlloc);
|
||||
BufferCapacity = std::max(Need, BufferCapacity * 2);
|
||||
if (Need < MinInitAlloc)
|
||||
Need = MinInitAlloc;
|
||||
BufferCapacity *= 2;
|
||||
if (BufferCapacity < Need)
|
||||
BufferCapacity = Need;
|
||||
Buffer = static_cast<char *>(std::realloc(Buffer, BufferCapacity));
|
||||
if (Buffer == nullptr)
|
||||
std::terminate();
|
||||
|
|
Loading…
Reference in New Issue