Skip to content

Commit aefbcb0

Browse files
add documentation
1 parent e79596d commit aefbcb0

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

lldb/source/Core/Mangled.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ static ConstString GetSwiftDemangledStr(ConstString m_mangled,
164164
std::max(info.BasenameRange.second, info.ArgumentsRange.second);
165165
info.SuffixRange.second = demangled.length();
166166

167-
// Don't cache the demangled name the function isn't available yet.
167+
// Don't cache the demangled name if the function isn't available yet.
168168
if (!sc || !sc->function) {
169169
LLDB_LOGF(log, "demangle swift: %s -> \"%s\" (not cached)", mangled_name,
170170
demangled.c_str());

lldb/source/Plugins/Language/Swift/SwiftMangled.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
using namespace swift::Demangle;
2020

21+
/// A NodePrinter class with range tracking capabilities.
22+
///
23+
/// When used instead of a regular NodePrinter, this class will store additional
24+
/// range information of the demangled name in the `info` attribute, such as the
25+
/// range of the name of a method.
2126
class TrackingNodePrinter : public NodePrinter {
2227
public:
2328
TrackingNodePrinter(DemangleOptions options) : NodePrinter(options) {}

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,27 @@ class SwiftLanguageRuntime : public LanguageRuntime {
201201

202202
enum DemangleMode { eSimplified, eTypeName, eDisplayTypeName };
203203

204+
/// Demangle a symbol to a string.
205+
///
206+
/// \param symbol The mangled symbol to demangle.
207+
/// \param mode The `DemangleMode` to use when demangling.
208+
/// \param sc The associated `SymbolContext`.
209+
/// \param exe_ctx The associated `ExecutionContext`.
210+
///
211+
/// \return The demangled symbol.
204212
static std::string
205213
DemangleSymbolAsString(llvm::StringRef symbol, DemangleMode mode,
206214
const SymbolContext *sc = nullptr,
207215
const ExecutionContext *exe_ctx = nullptr);
208216

217+
/// Demangle a symbol to a string with additional range information.
218+
///
219+
/// \param symbol The mangled symbol to demangle.
220+
/// \param mode The `DemangleMode` to use when demangling.
221+
/// \param sc The associated `SymbolContext`.
222+
/// \param exe_ctx The associated `ExecutionContext`.
223+
///
224+
/// \return The demangled symbol as well as range tracking information.
209225
static std::pair<std::string, DemangledNameInfo>
210226
TrackedDemangleSymbolAsString(llvm::StringRef symbol, DemangleMode mode,
211227
const SymbolContext *sc = nullptr,

0 commit comments

Comments
 (0)