summaryrefslogtreecommitdiff
path: root/libcxxabi
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2018-09-15 18:25:49 +0000
committerNico Weber <nicolasweber@gmx.de>2018-09-15 18:25:49 +0000
commit576a83195cc6f0468bd56e894633e1b86d380069 (patch)
treee7fc4c517da833f05089cb75c551651d98ffb51b /libcxxabi
parenta9a57ab2434474806d4810e415a6a2f72470e9f3 (diff)
Merge Demangle change in r342330 to libcxxabi.
Differential Revision: https://reviews.llvm.org/D52104
Diffstat (limited to 'libcxxabi')
-rw-r--r--libcxxabi/src/cxa_demangle.cpp15
-rw-r--r--libcxxabi/src/demangle/Utility.h31
2 files changed, 15 insertions, 31 deletions
diff --git a/libcxxabi/src/cxa_demangle.cpp b/libcxxabi/src/cxa_demangle.cpp
index 25edb650538..a9a7050000d 100644
--- a/libcxxabi/src/cxa_demangle.cpp
+++ b/libcxxabi/src/cxa_demangle.cpp
@@ -312,21 +312,6 @@ public:
return Alloc.allocate(sizeof(Node *) * sz);
}
};
-
-bool initializeOutputStream(char *Buf, size_t *N, OutputStream &S,
- size_t InitSize) {
- size_t BufferSize;
- if (Buf == nullptr) {
- Buf = static_cast<char *>(std::malloc(InitSize));
- if (Buf == nullptr)
- return true;
- BufferSize = InitSize;
- } else
- BufferSize = *N;
-
- S.reset(Buf, BufferSize);
- return false;
-}
} // unnamed namespace
//===----------------------------------------------------------------------===//
diff --git a/libcxxabi/src/demangle/Utility.h b/libcxxabi/src/demangle/Utility.h
index 39092436283..86113763031 100644
--- a/libcxxabi/src/demangle/Utility.h
+++ b/libcxxabi/src/demangle/Utility.h
@@ -71,22 +71,6 @@ public:
BufferCapacity = BufferCapacity_;
}
- /// Create an OutputStream from a buffer and a size. If either of these are
- /// null a buffer is allocated.
- static OutputStream create(char *StartBuf, size_t *Size, size_t AllocSize) {
- OutputStream Result;
-
- if (!StartBuf || !Size) {
- StartBuf = static_cast<char *>(std::malloc(AllocSize));
- if (StartBuf == nullptr)
- std::terminate();
- Size = &AllocSize;
- }
-
- Result.reset(StartBuf, *Size);
- return Result;
- }
-
/// If a ParameterPackExpansion (or similar type) is encountered, the offset
/// into the pack that we're currently printing.
unsigned CurrentPackIndex = std::numeric_limits<unsigned>::max();
@@ -186,6 +170,21 @@ public:
SwapAndRestore &operator=(const SwapAndRestore &) = delete;
};
+inline bool initializeOutputStream(char *Buf, size_t *N, OutputStream &S,
+ size_t InitSize) {
+ size_t BufferSize;
+ if (Buf == nullptr) {
+ Buf = static_cast<char *>(std::malloc(InitSize));
+ if (Buf == nullptr)
+ return true;
+ BufferSize = InitSize;
+ } else
+ BufferSize = *N;
+
+ S.reset(Buf, BufferSize);
+ return false;
+}
+
} // namespace
#endif