Port LLVM r346606 to libcxxabi.

llvm-svn: 346607
This commit is contained in:
Nico Weber 2018-11-11 10:09:06 +00:00
parent 6808bc0f45
commit 966c180ad2
2 changed files with 3 additions and 3 deletions

View File

@ -352,7 +352,7 @@ __cxa_demangle(const char *MangledName, char *Buf, size_t *N, int *Status) {
if (AST == nullptr)
InternalStatus = demangle_invalid_mangled_name;
else if (initializeOutputStream(Buf, N, S, 1024))
else if (!initializeOutputStream(Buf, N, S, 1024))
InternalStatus = demangle_memory_alloc_failure;
else {
assert(Parser.ForwardTemplateRefs.empty());

View File

@ -176,13 +176,13 @@ inline bool initializeOutputStream(char *Buf, size_t *N, OutputStream &S,
if (Buf == nullptr) {
Buf = static_cast<char *>(std::malloc(InitSize));
if (Buf == nullptr)
return true;
return false;
BufferSize = InitSize;
} else
BufferSize = *N;
S.reset(Buf, BufferSize);
return false;
return true;
}
} // namespace