Index: llvm/trunk/include/llvm/Demangle/Utility.h =================================================================== --- llvm/trunk/include/llvm/Demangle/Utility.h +++ llvm/trunk/include/llvm/Demangle/Utility.h @@ -175,13 +175,13 @@ if (Buf == nullptr) { Buf = static_cast(std::malloc(InitSize)); if (Buf == nullptr) - return true; + return false; BufferSize = InitSize; } else BufferSize = *N; S.reset(Buf, BufferSize); - return false; + return true; } #endif Index: llvm/trunk/lib/Demangle/ItaniumDemangle.cpp =================================================================== --- llvm/trunk/lib/Demangle/ItaniumDemangle.cpp +++ llvm/trunk/lib/Demangle/ItaniumDemangle.cpp @@ -340,7 +340,7 @@ 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()); @@ -396,7 +396,7 @@ static char *printNode(const Node *RootNode, char *Buf, size_t *N) { OutputStream S; - if (initializeOutputStream(Buf, N, S, 128)) + if (!initializeOutputStream(Buf, N, S, 128)) return nullptr; RootNode->print(S); S += '\0'; @@ -441,7 +441,7 @@ const Node *Name = static_cast(RootNode)->getName(); OutputStream S; - if (initializeOutputStream(Buf, N, S, 128)) + if (!initializeOutputStream(Buf, N, S, 128)) return nullptr; KeepGoingLocalFunction: @@ -494,7 +494,7 @@ NodeArray Params = static_cast(RootNode)->getParams(); OutputStream S; - if (initializeOutputStream(Buf, N, S, 128)) + if (!initializeOutputStream(Buf, N, S, 128)) return nullptr; S += '('; @@ -512,7 +512,7 @@ return nullptr; OutputStream S; - if (initializeOutputStream(Buf, N, S, 128)) + if (!initializeOutputStream(Buf, N, S, 128)) return nullptr; if (const Node *Ret = Index: llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp =================================================================== --- llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp +++ llvm/trunk/lib/Demangle/MicrosoftDemangle.cpp @@ -874,7 +874,7 @@ // Render this class template name into a string buffer so that we can // memorize it for the purpose of back-referencing. OutputStream OS; - if (initializeOutputStream(nullptr, nullptr, OS, 1024)) + if (!initializeOutputStream(nullptr, nullptr, OS, 1024)) // FIXME: Propagate out-of-memory as an error? std::terminate(); Identifier->output(OS, OF_Default); @@ -1207,7 +1207,7 @@ if (MangledName.empty()) goto StringLiteralError; - if (initializeOutputStream(nullptr, nullptr, OS, 1024)) + if (!initializeOutputStream(nullptr, nullptr, OS, 1024)) // FIXME: Propagate out-of-memory as an error? std::terminate(); if (IsWcharT) { @@ -1330,7 +1330,7 @@ // Render the parent symbol's name into a buffer. OutputStream OS; - if (initializeOutputStream(nullptr, nullptr, OS, 1024)) + if (!initializeOutputStream(nullptr, nullptr, OS, 1024)) // FIXME: Propagate out-of-memory as an error? std::terminate(); OS << '`'; @@ -2156,7 +2156,7 @@ // Create an output stream so we can render each type. OutputStream OS; - if (initializeOutputStream(nullptr, nullptr, OS, 1024)) + if (!initializeOutputStream(nullptr, nullptr, OS, 1024)) std::terminate(); for (size_t I = 0; I < Backrefs.FunctionParamCount; ++I) { OS.setCurrentPosition(0); @@ -2194,7 +2194,7 @@ if (D.Error) 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 { AST->output(S, OF_Default);