[libcxxabi] r342331 - Merge Demangle change in r342330 to libcxxabi.

Nico Weber nicolasweber at gmx.de
Sat Sep 15 11:25:49 PDT 2018


Author: nico
Date: Sat Sep 15 11:25:49 2018
New Revision: 342331

URL: http://llvm.org/viewvc/llvm-project?rev=342331&view=rev
Log:
Merge Demangle change in r342330 to libcxxabi.

Differential Revision: https://reviews.llvm.org/D52104

Modified:
    libcxxabi/trunk/src/cxa_demangle.cpp
    libcxxabi/trunk/src/demangle/Utility.h

Modified: libcxxabi/trunk/src/cxa_demangle.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=342331&r1=342330&r2=342331&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_demangle.cpp (original)
+++ libcxxabi/trunk/src/cxa_demangle.cpp Sat Sep 15 11:25:49 2018
@@ -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
 
 //===----------------------------------------------------------------------===//

Modified: libcxxabi/trunk/src/demangle/Utility.h
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/demangle/Utility.h?rev=342331&r1=342330&r2=342331&view=diff
==============================================================================
--- libcxxabi/trunk/src/demangle/Utility.h (original)
+++ libcxxabi/trunk/src/demangle/Utility.h Sat Sep 15 11:25:49 2018
@@ -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




More information about the libcxx-commits mailing list