Skip to content

Commit 979b749

Browse files
committed
[Backtracing][Linux] Move doc comment to header.
Moved the comment for `_swift_backtrace_demangle` into the header file instead of it being in the implementation. rdar://110261430
1 parent 14fcdbd commit 979b749

File tree

2 files changed

+28
-27
lines changed

2 files changed

+28
-27
lines changed

include/swift/Runtime/Backtrace.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,33 @@ SWIFT_RUNTIME_STDLIB_INTERNAL BacktraceSettings _swift_backtraceSettings;
136136

137137
SWIFT_RUNTIME_STDLIB_SPI SWIFT_CC(swift) bool _swift_isThunkFunction(const char *mangledName);
138138

139+
/// Try to demangle a symbol.
140+
///
141+
/// Unlike other entry points that do this, we try both Swift and C++ here.
142+
///
143+
/// @param mangledName is the symbol name to be demangled.
144+
/// @param mangledNameLength is the length of this name.
145+
/// @param outputBuffer is a pointer to a buffer in which to place the result.
146+
/// @param outputBufferSize points to a variable that contains the size of the
147+
/// output buffer.
148+
/// @param status returns the status codes defined in the C++ ABI.
149+
///
150+
/// If outputBuffer is nullptr, the function will allocate memory for the
151+
/// result using malloc(). In this case, outputBufferSize may be nullptr;
152+
/// if it is *not* nullptr, it will be set to the size of buffer that was
153+
/// allocated. This is not necessarily the length of the string (it may be
154+
/// somewhat higher).
155+
///
156+
/// Otherwise, the result will be written into the output buffer, and the
157+
/// size of the result will be written into outputBufferSize. If the buffer
158+
/// is too small, the result will be truncated, but outputBufferSize will
159+
/// still be set to the number of bytes that would have been required to
160+
/// copy out the full result (including a trailing NUL).
161+
///
162+
/// The unusual behaviour here is a consequence of the way the C++ ABI's
163+
/// demangling function works.
164+
///
165+
/// @returns a pointer to the output if demangling was successful.
139166
SWIFT_RUNTIME_STDLIB_SPI
140167
char *_swift_backtrace_demangle(const char *mangledName,
141168
size_t mangledNameLength,

stdlib/public/runtime/Backtrace.cpp

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -850,33 +850,7 @@ _swift_isThunkFunction(const char *mangledName) {
850850
return ctx.isThunkSymbol(mangledName);
851851
}
852852

853-
/// Try to demangle a symbol.
854-
///
855-
/// Unlike other entry points that do this, we try both Swift and C++ here.
856-
///
857-
/// @param mangledName is the symbol name to be demangled.
858-
/// @param mangledNameLength is the length of this name.
859-
/// @param outputBuffer is a pointer to a buffer in which to place the result.
860-
/// @param outputBufferSize points to a variable that contains the size of the
861-
/// output buffer.
862-
/// @param status returns the status codes defined in the C++ ABI.
863-
///
864-
/// If outputBuffer is nullptr, the function will allocate memory for the
865-
/// result using malloc(). In this case, outputBufferSize may be nullptr;
866-
/// if it is *not* nullptr, it will be set to the size of buffer that was
867-
/// allocated. This is not necessarily the length of the string (it may be
868-
/// somewhat higher).
869-
///
870-
/// Otherwise, the result will be written into the output buffer, and the
871-
/// size of the result will be written into outputBufferSize. If the buffer
872-
/// is too small, the result will be truncated, but outputBufferSize will
873-
/// still be set to the number of bytes that would have been required to
874-
/// copy out the full result (including a trailing NUL).
875-
///
876-
/// The unusual behaviour here is a consequence of the way the C++ ABI's
877-
/// demangling function works.
878-
///
879-
/// @returns a pointer to the output if demangling was successful.
853+
// Try to demangle a symbol.
880854
SWIFT_RUNTIME_STDLIB_SPI char *
881855
_swift_backtrace_demangle(const char *mangledName,
882856
size_t mangledNameLength,

0 commit comments

Comments
 (0)