Chromium Code Reviews| Index: base/android/cxa_demangle_stub.cc |
| diff --git a/base/android/cxa_demangle_stub.cc b/base/android/cxa_demangle_stub.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b0d2b87c59364fe8cf8517cb5672ebeec8994d02 |
| --- /dev/null |
| +++ b/base/android/cxa_demangle_stub.cc |
| @@ -0,0 +1,19 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include <unistd.h> |
| + |
| +// LLVM's demangler is large, and we have no need of it. Overriding it with |
| +// our own stub version here stops a lot of code being pulled in from libc++. |
| +// More here: |
| +// https://llvm.org/svn/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp |
| +extern "C" char* __cxa_demangle(const char* mangled_name, |
| + char* buf, |
| + size_t* n, |
| + int* status) { |
| + static const int kMemoryAllocFailure = -1; // LLVM's memory_alloc_failure. |
|
rmcilroy
2015/06/26 12:43:49
Can we just do a CHECK(false) here instead? This w
simonb (inactive)
2015/06/26 15:00:09
I'm pretty sure we don't want to CHECK(false) here
rmcilroy
2015/06/29 09:24:18
Ok sounds good, thanks for the explanation.
|
| + if (status) |
| + *status = kMemoryAllocFailure; |
| + return nullptr; |
| +} |