xref: /aosp_15_r20/external/cronet/buildtools/third_party/libc++abi/cxa_demangle_stub.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2018 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <stddef.h>
6 
7 #include <__cxxabi_config.h>
8 
9 extern "C"
10 // LLVM's demangler is large, and we have no need of it.  Overriding it with
11 // our own stub version here stops a lot of code being pulled in from libc++.
12 // More here:
13 //   https://llvm.org/svn/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp
14 _LIBCXXABI_FUNC_VIS
15 // This is a weak symbol to let android_crazy_linker override it in
16 // //base/android/linker:chromium_android_linker.
__cxa_demangle(const char * mangled_name,char * buf,size_t * n,int * status)17 _LIBCXXABI_WEAK char* __cxa_demangle(const char* mangled_name,
18                                      char* buf,
19                                      size_t* n,
20                                      int* status) {
21   static const int kMemoryAllocFailure = -1;  // LLVM's memory_alloc_failure.
22   if (status)
23     *status = kMemoryAllocFailure;
24   return nullptr;
25 }
26