Skip to content

Commit c250a84

Browse files
committed
[Runtime] Add a declaration for swift_demangle to the header file and export it.
rdar://problem/20356017
1 parent 50697a7 commit c250a84

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

include/swift/Demangling/Demangle.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <cassert>
2525
#include <cstdint>
2626
#include "llvm/ADT/StringRef.h"
27+
#include "swift/Runtime/Config.h"
2728

2829
namespace llvm {
2930
class raw_ostream;
@@ -528,4 +529,30 @@ llvm::StringRef makeSymbolicMangledNameStringRef(const char *base);
528529
} // end namespace Demangle
529530
} // end namespace swift
530531

532+
// NB: This function is not used directly in the Swift codebase, but is
533+
// exported for Xcode support and is used by the sanitizers. Please coordinate
534+
// before changing.
535+
//
536+
/// Demangles a Swift symbol name.
537+
///
538+
/// \param mangledName is the symbol name that needs to be demangled.
539+
/// \param mangledNameLength is the length of the string that should be
540+
/// demangled.
541+
/// \param outputBuffer is the user provided buffer where the demangled name
542+
/// will be placed. If nullptr, a new buffer will be malloced. In that case,
543+
/// the user of this API is responsible for freeing the returned buffer.
544+
/// \param outputBufferSize is the size of the output buffer. If the demangled
545+
/// name does not fit into the outputBuffer, the output will be truncated and
546+
/// the size will be updated, indicating how large the buffer should be.
547+
/// \param flags can be used to select the demangling style. TODO: We should
548+
//// define what these will be.
549+
/// \returns the demangled name. Returns nullptr if the input String is not a
550+
/// Swift mangled name.
551+
SWIFT_RUNTIME_EXPORT
552+
char *swift_demangle(const char *mangledName,
553+
size_t mangledNameLength,
554+
char *outputBuffer,
555+
size_t *outputBufferSize,
556+
uint32_t flags);
557+
531558
#endif // SWIFT_DEMANGLING_DEMANGLE_H

stdlib/public/runtime/Demangle.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -639,23 +639,6 @@ swift::_swift_buildDemanglingForMetadata(const Metadata *type,
639639
// NB: This function is not used directly in the Swift codebase, but is
640640
// exported for Xcode support and is used by the sanitizers. Please coordinate
641641
// before changing.
642-
//
643-
/// Demangles a Swift symbol name.
644-
///
645-
/// \param mangledName is the symbol name that needs to be demangled.
646-
/// \param mangledNameLength is the length of the string that should be
647-
/// demangled.
648-
/// \param outputBuffer is the user provided buffer where the demangled name
649-
/// will be placed. If nullptr, a new buffer will be malloced. In that case,
650-
/// the user of this API is responsible for freeing the returned buffer.
651-
/// \param outputBufferSize is the size of the output buffer. If the demangled
652-
/// name does not fit into the outputBuffer, the output will be truncated and
653-
/// the size will be updated, indicating how large the buffer should be.
654-
/// \param flags can be used to select the demangling style. TODO: We should
655-
//// define what these will be.
656-
/// \returns the demangled name. Returns nullptr if the input String is not a
657-
/// Swift mangled name.
658-
SWIFT_RUNTIME_EXPORT
659642
char *swift_demangle(const char *mangledName,
660643
size_t mangledNameLength,
661644
char *outputBuffer,

0 commit comments

Comments
 (0)