LLDB mainline
Language.h
Go to the documentation of this file.
1//===-- Language.h --------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_TARGET_LANGUAGE_H
10#define LLDB_TARGET_LANGUAGE_H
11
12#include <functional>
13#include <memory>
14#include <optional>
15#include <set>
16#include <string>
17#include <vector>
18
21#include "lldb/Core/Mangled.h"
27#include "lldb/lldb-private.h"
28#include "lldb/lldb-public.h"
29#include "llvm/ADT/StringRef.h"
30#include "llvm/Support/FormatVariadic.h"
31
32namespace lldb_private {
33
35public:
37
38 static llvm::StringRef GetSettingName();
39
41};
42
43class Language : public PluginInterface {
44public:
46 public:
47 class Result {
48 public:
49 virtual bool IsValid() = 0;
50
51 virtual bool DumpToStream(Stream &stream,
52 bool print_help_if_available) = 0;
53
54 virtual ~Result() = default;
55 };
56
57 typedef std::set<std::unique_ptr<Result>> ResultSet;
58
59 virtual ~TypeScavenger() = default;
60
61 size_t Find(ExecutionContextScope *exe_scope, const char *key,
62 ResultSet &results, bool append = true);
63
64 protected:
65 TypeScavenger() = default;
66
67 virtual bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
68 ResultSet &results) = 0;
69 };
70
73 public:
75
76 bool IsValid() override { return m_compiler_type.IsValid(); }
77
78 bool DumpToStream(Stream &stream, bool print_help_if_available) override {
79 if (IsValid()) {
80 m_compiler_type.DumpTypeDescription(&stream);
81 stream.EOL();
82 return true;
83 }
84 return false;
85 }
86
87 ~Result() override = default;
88
89 private:
91 };
92
93 protected:
95
96 ~ImageListTypeScavenger() override = default;
97
98 // is this type something we should accept? it's usually going to be a
99 // filter by language + maybe some sugar tweaking
100 // returning an empty type means rejecting this candidate entirely;
101 // any other result will be accepted as a valid match
103
104 bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
105 ResultSet &results) override;
106 };
107
108 template <typename... ScavengerTypes>
110 public:
112 for (std::shared_ptr<TypeScavenger> scavenger : { std::shared_ptr<TypeScavenger>(new ScavengerTypes())... }) {
113 if (scavenger)
114 m_scavengers.push_back(scavenger);
115 }
116 }
117 protected:
118 bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
119 ResultSet &results) override {
120 const bool append = false;
121 for (auto& scavenger : m_scavengers) {
122 if (scavenger && scavenger->Find(exe_scope, key, results, append))
123 return true;
124 }
125 return false;
126 }
127 private:
128 std::vector<std::shared_ptr<TypeScavenger>> m_scavengers;
129 };
130
131 template <typename... ScavengerTypes>
133 public:
135 for (std::shared_ptr<TypeScavenger> scavenger : { std::shared_ptr<TypeScavenger>(new ScavengerTypes())... }) {
136 if (scavenger)
137 m_scavengers.push_back(scavenger);
138 }
139 }
140 protected:
141 bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
142 ResultSet &results) override {
143 const bool append = true;
144 bool success = false;
145 for (auto& scavenger : m_scavengers) {
146 if (scavenger)
147 success = scavenger->Find(exe_scope, key, results, append) || success;
148 }
149 return success;
150 }
151 private:
152 std::vector<std::shared_ptr<TypeScavenger>> m_scavengers;
153 };
154
160
161 ~Language() override;
162
163 static Language *FindPlugin(lldb::LanguageType language);
164
165 /// Returns the Language associated with the given file path or a nullptr
166 /// if there is no known language.
167 static Language *FindPlugin(llvm::StringRef file_path);
168
169 static Language *FindPlugin(lldb::LanguageType language,
170 llvm::StringRef file_path);
171
172 /// Returns the Language that registered \p scheme with
173 /// Mangled::RegisterManglingScheme(), or a nullptr if none did.
175
176 static llvm::Expected<lldb::LanguageType>
177 GetExceptionLanguageForLanguage(llvm::StringRef lang_name);
178 // return false from callback to stop iterating
179 static void ForEach(llvm::function_ref<IterationAction(Language *)> callback);
180
181 /// Returns lldb_private::GetVersion(), followed by the GetVersionInfo() of
182 /// each registered language plugin, in language type order.
183 static std::string GetVersionWithLanguageInfo();
184
186
187 // Implement this function to return the user-defined entry point name
188 // for the language.
189 virtual llvm::StringRef GetUserEntryPointName() const { return {}; }
190
191 virtual bool IsTopLevelFunction(Function &function);
192
193 virtual bool IsSourceFile(llvm::StringRef file_path) const = 0;
194
196
198
200
203
204 virtual std::vector<FormattersMatchCandidate>
206 lldb::DynamicValueType use_dynamic);
207
208 /// Returns the languages whose formatters apply to values of \p language,
209 /// in the order in which to consult them. FormatManager consults the
210 /// formatters of every language that a language plugin returns. By default,
211 /// the formatters of this language apply to its own values.
212 virtual std::vector<lldb::LanguageType>
214
215 /// Returns whether the formatters in a category for \p category_language,
216 /// one of the languages of this plugin, apply to values of
217 /// \p valobj_language. By default, they only apply to values of
218 /// \p category_language.
219 virtual bool IsCategoryApplicable(lldb::LanguageType category_language,
220 lldb::LanguageType valobj_language) const {
221 return category_language == valobj_language;
222 }
223
224 /// Returns the options that this language adds to the commands that
225 /// evaluate expressions, or nullptr.
226 virtual std::unique_ptr<OptionGroupLanguageExpression>
228
229 virtual std::unique_ptr<TypeScavenger> GetTypeScavenger();
230
231 virtual const char *GetLanguageSpecificTypeLookupHelp();
232
234 std::string m_name;
235 lldb::FunctionNameType m_type;
236
237 public:
238 MethodNameVariant(std::string name, lldb::FunctionNameType type)
239 : m_name(std::move(name)), m_type(type) {}
240 llvm::StringRef GetName() const { return m_name; }
241 lldb::FunctionNameType GetType() const { return m_type; }
242 };
243 // If a language can have more than one possible name for a method, this
244 // function can be used to enumerate them. This is useful when doing name
245 // lookups.
246 virtual std::vector<Language::MethodNameVariant>
247 GetMethodNameVariants(llvm::StringRef method_name) const {
248 return std::vector<Language::MethodNameVariant>();
249 }
250
252 public:
254
255 MethodName(std::string full)
256 : m_full(std::move(full)), m_basename(), m_context(), m_arguments(),
258 m_parse_error(false) {}
259
260 virtual ~MethodName() {};
261
262 void Clear() {
263 m_full = {};
264 m_basename = llvm::StringRef();
265 m_context = llvm::StringRef();
266 m_arguments = llvm::StringRef();
267 m_qualifiers = llvm::StringRef();
268 m_return_type = llvm::StringRef();
269 m_scope_qualified.clear();
270 m_parsed = false;
271 m_parse_error = false;
272 }
273
274 bool IsValid() {
275 if (!m_parsed)
276 Parse();
277 if (m_parse_error)
278 return false;
279 return !m_full.empty();
280 }
281
282 const std::string &GetFullName() const { return m_full; }
283
284 llvm::StringRef GetBasename() {
285 if (!m_parsed)
286 Parse();
287 return m_basename;
288 }
289
290 llvm::StringRef GetContext() {
291 if (!m_parsed)
292 Parse();
293 return m_context;
294 }
295
296 llvm::StringRef GetArguments() {
297 if (!m_parsed)
298 Parse();
299 return m_arguments;
300 }
301
302 llvm::StringRef GetQualifiers() {
303 if (!m_parsed)
304 Parse();
305 return m_qualifiers;
306 }
307
308 llvm::StringRef GetReturnType() {
309 if (!m_parsed)
310 Parse();
311 return m_return_type;
312 }
313
314 std::string GetScopeQualifiedName() {
315 if (!m_parsed)
316 Parse();
317 return m_scope_qualified;
318 }
319
320 protected:
321 virtual void Parse() {
322 m_parsed = true;
323 m_parse_error = true;
324 }
325
326 std::string m_full; // Full name:
327 // "size_t lldb::SBTarget::GetBreakpointAtIndex(unsigned
328 // int) const"
329 llvm::StringRef m_basename; // Basename: "GetBreakpointAtIndex"
330 llvm::StringRef m_context; // Decl context: "lldb::SBTarget"
331 llvm::StringRef m_arguments; // Arguments: "(unsigned int)"
332 llvm::StringRef m_qualifiers; // Qualifiers: "const"
333 llvm::StringRef m_return_type; // Return type: "size_t"
334 std::string m_scope_qualified;
335 bool m_parsed = false;
336 bool m_parse_error = false;
337 };
338
339 virtual std::unique_ptr<Language::MethodName>
340 GetMethodName(llvm::StringRef name) const {
341 return std::make_unique<Language::MethodName>(name.str());
342 }
343
344 virtual std::pair<lldb::FunctionNameType, std::optional<ConstString>>
346 return std::pair{lldb::eFunctionNameTypeNone, std::nullopt};
347 };
348
349 /// Returns true iff the given symbol name is compatible with the mangling
350 /// scheme of this language.
351 ///
352 /// This function should only return true if there is a high confidence
353 /// that the name actually belongs to this language.
354 virtual bool SymbolNameFitsToLanguage(const Mangled &name) const {
355 return false;
356 }
357
358 /// How to demangle a name in DemangleSymbol().
360 /// Whether to compute the \c DemangledNameInfo too.
361 bool want_info = false;
362 };
363
364 /// A demangled name and, if requested, where its parts begin and end.
366 /// Empty if the name couldn't be demangled.
367 std::string name;
368 /// Only computed if DemangleOptions::want_info is true.
369 std::optional<DemangledNameInfo> info;
370 };
371
372 /// Demangle \p mangled, a name mangled with \p scheme, a scheme that this
373 /// language registered with Mangled::RegisterManglingScheme().
376 const DemangleOptions &options) const {
377 return {};
378 }
379
380 /// Parses mangled function names.
382 public:
383 virtual ~MangledNameParser() = default;
384
385 /// Parse a function name. Returns std::nullopt if \p mangled isn't a
386 /// function name that this parser understands.
387 virtual std::optional<Mangled::FunctionNameParts>
388 Parse(const Mangled &mangled) = 0;
389 };
390
391 /// Returns a parser for the names mangled with \p scheme, a scheme that this
392 /// language registered, or a nullptr if the symbol table should index them
393 /// by their demangled names.
394 virtual std::unique_ptr<MangledNameParser>
396 return nullptr;
397 }
398
399 /// An individual data formatter may apply to several types and cross language
400 /// boundaries. Each of those languages may want to customize the display of
401 /// values of said types by appending proper prefix/suffix information in
402 /// language-specific ways. This function returns that prefix and suffix.
403 ///
404 /// \param[in] type_hint
405 /// A StringRef used to determine what the prefix and suffix should be. It
406 /// is called a hint because some types may have multiple variants for which
407 /// the prefix and/or suffix may vary.
408 ///
409 /// \return
410 /// A std::pair<StringRef, StringRef>, the first being the prefix and the
411 /// second being the suffix. They may be empty.
412 virtual std::pair<llvm::StringRef, llvm::StringRef>
413 GetFormatterPrefixSuffix(llvm::StringRef type_hint);
414
415 // When looking up functions, we take a user provided string which may be a
416 // partial match to the full demangled name and compare it to the actual
417 // demangled name to see if it matches as much as the user specified. An
418 // example of this is if the user provided A::my_function, but the
419 // symbol was really B::A::my_function. We want that to be
420 // a match. But we wouldn't want this to match AnotherA::my_function. The
421 // user is specifying a truncated path, not a truncated set of characters.
422 // This function does a language-aware comparison for those purposes.
423 virtual bool DemangledNameContainsPath(llvm::StringRef path,
424 ConstString demangled) const;
425
426 // if a language has a custom format for printing variable declarations that
427 // it wants LLDB to honor it should return an appropriate closure here
429
430 virtual LazyBool IsLogicalTrue(ValueObject &valobj, Status &error);
431
432 // for a ValueObject of some "reference type", if the value points to the
433 // nil/null object, this method returns true
434 virtual bool IsNilReference(ValueObject &valobj);
435
436 /// Returns the summary string for ValueObjects for which IsNilReference() is
437 /// true.
438 virtual llvm::StringRef GetNilReferenceSummaryString() { return {}; }
439
440 // for a ValueObject of some "reference type", if the language provides a
441 // technique to decide whether the reference has ever been assigned to some
442 // object, this method will return true if such detection is possible, and if
443 // the reference has never been assigned
444 virtual bool IsUninitializedReference(ValueObject &valobj);
445
446 virtual bool GetFunctionDisplayName(const SymbolContext &sc,
447 const ExecutionContext *exe_ctx,
448 FunctionNameRepresentation representation,
449 Stream &s);
450
452 const ExecutionContext *exe_ctx,
454 Stream &s) {
455 return false;
456 }
457
458 virtual ConstString
460 if (ConstString demangled = mangled.GetDemangledName())
461 return demangled;
462
463 return mangled.GetMangledName();
464 }
465
467 return mangled.GetDemangledName();
468 }
469
470 virtual void GetExceptionResolverDescription(bool catch_on, bool throw_on,
471 Stream &s);
472
473 static void GetDefaultExceptionResolverDescription(bool catch_on,
474 bool throw_on, Stream &s);
475
476 // These are accessors for general information about the Languages lldb knows
477 // about:
478
479 static lldb::LanguageType
480 GetLanguageTypeFromString(const char *string) = delete;
481 static lldb::LanguageType GetLanguageTypeFromString(llvm::StringRef string);
482
483 /// Returns the internal LLDB name for the specified language. When presenting
484 /// the language name to users, use \ref GetDisplayNameForLanguageType
485 /// instead.
486 static const char *GetNameForLanguageType(lldb::LanguageType language);
487
488 /// Returns a user-friendly name for the specified language.
489 static llvm::StringRef
491
492 static void PrintAllLanguages(Stream &s, const char *prefix,
493 const char *suffix);
494
495 /// Prints to the specified stream 's' each language type that the
496 /// current target supports for expression evaluation.
497 ///
498 /// \param[out] s Stream to which the language types are written.
499 /// \param[in] prefix String that is prepended to the language type.
500 /// \param[in] suffix String that is appended to the language type.
502 llvm::StringRef prefix,
503 llvm::StringRef suffix);
504
505 // return false from callback to stop iterating
506 static void ForAllLanguages(
507 llvm::function_ref<IterationAction(lldb::LanguageType)> callback);
508
509 static bool LanguageIsCPlusPlus(lldb::LanguageType language);
510
511 static bool LanguageIsObjC(lldb::LanguageType language);
512
513 static bool LanguageIsC(lldb::LanguageType language);
514
515 /// Equivalent to \c LanguageIsC||LanguageIsObjC||LanguageIsCPlusPlus.
516 static bool LanguageIsCFamily(lldb::LanguageType language);
517
518 static bool LanguageIsFortran(lldb::LanguageType language);
519
520 static bool LanguageIsPascal(lldb::LanguageType language);
521
522 static bool LanguageIsRust(lldb::LanguageType language);
523
524 // return the primary language, so if LanguageIsC(l), return eLanguageTypeC,
525 // etc.
527
528 static std::set<lldb::LanguageType> GetSupportedLanguages();
529
533
535
536 // Given a mangled function name, calculates some alternative manglings since
537 // the compiler mangling may not line up with the symbol we are expecting.
538 virtual std::vector<ConstString>
540 return std::vector<ConstString>();
541 }
542
543 virtual ConstString
545 const SymbolContext &sym_ctx) const {
546 return ConstString();
547 }
548
549 virtual llvm::StringRef GetInstanceName() { return {}; }
550
551 /// Given a symbol context list of matches which supposedly represent the
552 /// same file and line number in a CU, erases those that should be ignored
553 /// when setting breakpoints by line (number or regex). Helpful for languages
554 /// that create split a single source-line into many functions (e.g. call
555 /// sites transformed by CoroSplitter).
556 virtual void
558
559 /// Returns a boolean indicating whether two symbol contexts are equal for the
560 /// purposes of frame comparison. If the plugin has no opinion, it should
561 /// return nullopt.
562 virtual std::optional<bool>
564 const SymbolContext &sc2) const {
565 return {};
566 }
567
568 /// Returns an explanation of why there is no variable named \p name in
569 /// \p sc, for example because \p sc is a closure that didn't capture a
570 /// variable of that name from its parent function, or an empty string.
571 virtual std::string
572 GetMissingVariableDiagnostic(llvm::StringRef name,
573 const SymbolContext &sc) const {
574 return {};
575 }
576
577 virtual std::optional<bool> GetBooleanFromString(llvm::StringRef str) const;
578
579 /// Returns true if this Language supports exception breakpoints on throw via
580 /// a corresponding LanguageRuntime plugin.
581 virtual bool SupportsExceptionBreakpointsOnThrow() const { return false; }
582
583 /// Returns true if this Language supports exception breakpoints on catch via
584 /// a corresponding LanguageRuntime plugin.
585 virtual bool SupportsExceptionBreakpointsOnCatch() const { return false; }
586
587 /// Returns the keyword used for throw statements in this language, e.g.
588 /// Python uses \b raise. Defaults to \b throw.
589 virtual llvm::StringRef GetThrowKeyword() const { return "throw"; }
590
591 /// Returns the keyword used for catch statements in this language, e.g.
592 /// Python uses \b except. Defaults to \b catch.
593 virtual llvm::StringRef GetCatchKeyword() const { return "catch"; }
594
595 virtual FormatEntity::Entry GetFunctionNameFormat() const { return {}; }
596
597 /// Returns text to append to LLDB's version string, such as the
598 /// revisions of compilers embedded in this plugin.
599 virtual std::string GetVersionInfo() const { return {}; }
600
601protected:
602 // Classes that inherit from Language can see and modify these
603
605
606private:
607 Language(const Language &) = delete;
608 const Language &operator=(const Language &) = delete;
609};
610
611} // namespace lldb_private
612
613namespace llvm {
614template <> struct format_provider<lldb::LanguageType> {
615 static void format(const lldb::LanguageType &language, llvm::raw_ostream &OS,
616 llvm::StringRef Options);
617};
618} // namespace llvm
619
620#endif // LLDB_TARGET_LANGUAGE_H
static llvm::raw_ostream & error(Stream &strm)
Generic representation of a type in a programming language.
A uniqued constant string class.
Definition ConstString.h:40
std::function< bool(llvm::StringRef, llvm::StringRef, const DumpValueObjectOptions &, Stream &)> DeclPrintingHelper
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
A class that describes a function.
Definition Function.h:386
HardcodedFormatterFinders< SyntheticChildren > HardcodedSyntheticFinder
HardcodedFormatterFinders< TypeSummaryImpl > HardcodedSummaryFinder
HardcodedFormatterFinders< TypeFormatImpl > HardcodedFormatFinder
static llvm::StringRef GetSettingName()
Definition Language.cpp:45
bool GetEnableFilterForLineBreakpoints() const
Definition Language.cpp:55
bool Find_Impl(ExecutionContextScope *exe_scope, const char *key, ResultSet &results) override
Definition Language.h:118
std::vector< std::shared_ptr< TypeScavenger > > m_scavengers
Definition Language.h:128
bool DumpToStream(Stream &stream, bool print_help_if_available) override
Definition Language.h:78
virtual CompilerType AdjustForInclusion(CompilerType &candidate)=0
bool Find_Impl(ExecutionContextScope *exe_scope, const char *key, ResultSet &results) override
Definition Language.cpp:509
Parses mangled function names.
Definition Language.h:381
virtual std::optional< Mangled::FunctionNameParts > Parse(const Mangled &mangled)=0
Parse a function name.
lldb::FunctionNameType GetType() const
Definition Language.h:241
MethodNameVariant(std::string name, lldb::FunctionNameType type)
Definition Language.h:238
const std::string & GetFullName() const
Definition Language.h:282
llvm::StringRef GetQualifiers()
Definition Language.h:302
llvm::StringRef GetReturnType()
Definition Language.h:308
virtual bool DumpToStream(Stream &stream, bool print_help_if_available)=0
std::set< std::unique_ptr< Result > > ResultSet
Definition Language.h:57
virtual bool Find_Impl(ExecutionContextScope *exe_scope, const char *key, ResultSet &results)=0
size_t Find(ExecutionContextScope *exe_scope, const char *key, ResultSet &results, bool append=true)
Definition Language.cpp:490
std::vector< std::shared_ptr< TypeScavenger > > m_scavengers
Definition Language.h:152
bool Find_Impl(ExecutionContextScope *exe_scope, const char *key, ResultSet &results) override
Definition Language.h:141
virtual bool IsSourceFile(llvm::StringRef file_path) const =0
static void PrintSupportedLanguagesForExpressions(Stream &s, llvm::StringRef prefix, llvm::StringRef suffix)
Prints to the specified stream 's' each language type that the current target supports for expression...
Definition Language.cpp:303
static bool LanguageIsRust(lldb::LanguageType language)
Definition Language.cpp:409
static LanguageSet GetLanguagesSupportingREPLs()
Definition Language.cpp:480
static LanguageSet GetLanguagesSupportingTypeSystems()
Definition Language.cpp:472
virtual std::optional< bool > GetBooleanFromString(llvm::StringRef str) const
Definition Language.cpp:580
virtual ConstString GetDisplayDemangledName(Mangled mangled) const
Definition Language.h:466
static std::string GetVersionWithLanguageInfo()
Returns lldb_private::GetVersion(), followed by the GetVersionInfo() of each registered language plug...
Definition Language.cpp:117
virtual std::vector< FormattersMatchCandidate > GetPossibleFormattersMatches(ValueObject &valobj, lldb::DynamicValueType use_dynamic)
Definition Language.cpp:193
virtual bool HandleFrameFormatVariable(const SymbolContext &sc, const ExecutionContext *exe_ctx, FormatEntity::Entry::Type type, Stream &s)
Definition Language.h:451
virtual bool SupportsExceptionBreakpointsOnCatch() const
Returns true if this Language supports exception breakpoints on catch via a corresponding LanguageRun...
Definition Language.h:585
virtual DemangledName DemangleSymbol(ConstString mangled, Mangled::ManglingScheme scheme, const DemangleOptions &options) const
Demangle mangled, a name mangled with scheme, a scheme that this language registered with Mangled::Re...
Definition Language.h:374
virtual lldb::TypeCategoryImplSP GetFormatters()
Definition Language.cpp:177
virtual llvm::StringRef GetInstanceName()
Definition Language.h:549
virtual std::unique_ptr< OptionGroupLanguageExpression > CreateExpressionOptions()
Returns the options that this language adds to the commands that evaluate expressions,...
Definition Language.cpp:206
static void ForEach(llvm::function_ref< IterationAction(Language *)> callback)
Definition Language.cpp:109
virtual std::unique_ptr< MangledNameParser > CreateMangledNameParser(Mangled::ManglingScheme scheme) const
Returns a parser for the names mangled with scheme, a scheme that this language registered,...
Definition Language.h:395
static void ForAllLanguages(llvm::function_ref< IterationAction(lldb::LanguageType)> callback)
Definition Language.cpp:321
static Language * FindPlugin(lldb::LanguageType language)
Definition Language.cpp:61
static const char * GetNameForLanguageType(lldb::LanguageType language)
Returns the internal LLDB name for the specified language.
Definition Language.cpp:292
virtual bool SymbolNameFitsToLanguage(const Mangled &name) const
Returns true iff the given symbol name is compatible with the mangling scheme of this language.
Definition Language.h:354
virtual void FilterForLineBreakpoints(llvm::SmallVectorImpl< SymbolContext > &) const
Given a symbol context list of matches which supposedly represent the same file and line number in a ...
Definition Language.h:557
virtual DumpValueObjectOptions::DeclPrintingHelper GetDeclPrintingHelper()
Definition Language.cpp:549
virtual std::unique_ptr< Language::MethodName > GetMethodName(llvm::StringRef name) const
Definition Language.h:340
static LanguageProperties & GetGlobalLanguageProperties()
Definition Language.cpp:40
virtual LazyBool IsLogicalTrue(ValueObject &valobj, Status &error)
Definition Language.cpp:553
virtual ConstString GetDemangledFunctionNameWithoutArguments(Mangled mangled) const
Definition Language.h:459
virtual const char * GetLanguageSpecificTypeLookupHelp()
Definition Language.cpp:488
virtual bool GetFunctionDisplayName(const SymbolContext &sc, const ExecutionContext *exe_ctx, FunctionNameRepresentation representation, Stream &s)
Definition Language.cpp:561
virtual std::pair< llvm::StringRef, llvm::StringRef > GetFormatterPrefixSuffix(llvm::StringRef type_hint)
An individual data formatter may apply to several types and cross language boundaries.
Definition Language.cpp:537
virtual llvm::StringRef GetCatchKeyword() const
Returns the keyword used for catch statements in this language, e.g.
Definition Language.h:593
virtual std::string GetVersionInfo() const
Returns text to append to LLDB's version string, such as the revisions of compilers embedded in this ...
Definition Language.h:599
virtual llvm::StringRef GetThrowKeyword() const
Returns the keyword used for throw statements in this language, e.g.
Definition Language.h:589
static bool LanguageIsC(lldb::LanguageType language)
Definition Language.cpp:354
virtual lldb::LanguageType GetLanguageType() const =0
virtual HardcodedFormatters::HardcodedSummaryFinder GetHardcodedSummaries()
Definition Language.cpp:183
static void GetDefaultExceptionResolverDescription(bool catch_on, bool throw_on, Stream &s)
Definition Language.cpp:573
virtual std::pair< lldb::FunctionNameType, std::optional< ConstString > > GetFunctionNameInfo(ConstString name) const
Definition Language.h:345
virtual std::string GetMissingVariableDiagnostic(llvm::StringRef name, const SymbolContext &sc) const
Returns an explanation of why there is no variable named name in sc, for example because sc is a clos...
Definition Language.h:572
virtual bool SupportsExceptionBreakpointsOnThrow() const
Returns true if this Language supports exception breakpoints on throw via a corresponding LanguageRun...
Definition Language.h:581
virtual std::optional< bool > AreEqualForFrameComparison(const SymbolContext &sc1, const SymbolContext &sc2) const
Returns a boolean indicating whether two symbol contexts are equal for the purposes of frame comparis...
Definition Language.h:563
virtual std::vector< Language::MethodNameVariant > GetMethodNameVariants(llvm::StringRef method_name) const
Definition Language.h:247
virtual bool DemangledNameContainsPath(llvm::StringRef path, ConstString demangled) const
Definition Language.cpp:541
virtual std::vector< ConstString > GenerateAlternateFunctionManglings(const ConstString mangled) const
Definition Language.h:539
static bool LanguageIsCPlusPlus(lldb::LanguageType language)
Definition Language.cpp:329
static llvm::StringRef GetDisplayNameForLanguageType(lldb::LanguageType language)
Returns a user-friendly name for the specified language.
Definition Language.cpp:299
static Language * FindPluginForManglingScheme(Mangled::ManglingScheme scheme)
Returns the Language that registered scheme with Mangled::RegisterManglingScheme(),...
Definition Language.cpp:88
static lldb::LanguageType GetPrimaryLanguage(lldb::LanguageType language)
Definition Language.cpp:413
virtual std::vector< lldb::LanguageType > GetFormatterLanguages(lldb::LanguageType language) const
Returns the languages whose formatters apply to values of language, in the order in which to consult ...
Definition Language.cpp:199
const Language & operator=(const Language &)=delete
virtual ConstString FindBestAlternateFunctionMangledName(const Mangled mangled, const SymbolContext &sym_ctx) const
Definition Language.h:544
static bool LanguageIsPascal(lldb::LanguageType language)
Definition Language.cpp:400
virtual bool IsNilReference(ValueObject &valobj)
Definition Language.cpp:557
virtual bool IsUninitializedReference(ValueObject &valobj)
Definition Language.cpp:559
virtual FormatEntity::Entry GetFunctionNameFormat() const
Definition Language.h:595
virtual llvm::StringRef GetNilReferenceSummaryString()
Returns the summary string for ValueObjects for which IsNilReference() is true.
Definition Language.h:438
static void PrintAllLanguages(Stream &s, const char *prefix, const char *suffix)
Definition Language.cpp:314
static llvm::Expected< lldb::LanguageType > GetExceptionLanguageForLanguage(llvm::StringRef lang_name)
Definition Language.cpp:134
virtual HardcodedFormatters::HardcodedSyntheticFinder GetHardcodedSynthetics()
Definition Language.cpp:188
virtual std::unique_ptr< TypeScavenger > GetTypeScavenger()
Definition Language.cpp:484
virtual bool IsCategoryApplicable(lldb::LanguageType category_language, lldb::LanguageType valobj_language) const
Returns whether the formatters in a category for category_language, one of the languages of this plug...
Definition Language.h:219
static bool LanguageIsFortran(lldb::LanguageType language)
Definition Language.cpp:386
static LanguageSet GetLanguagesSupportingTypeSystemsForExpressions()
Definition Language.cpp:476
virtual llvm::StringRef GetUserEntryPointName() const
Definition Language.h:189
virtual bool IsTopLevelFunction(Function &function)
Definition Language.cpp:175
virtual void GetExceptionResolverDescription(bool catch_on, bool throw_on, Stream &s)
Definition Language.cpp:568
static lldb::LanguageType GetLanguageTypeFromString(const char *string)=delete
Language(const Language &)=delete
static bool LanguageIsCFamily(lldb::LanguageType language)
Equivalent to LanguageIsC||LanguageIsObjC||LanguageIsCPlusPlus.
Definition Language.cpp:366
static std::set< lldb::LanguageType > GetSupportedLanguages()
Definition Language.cpp:463
virtual HardcodedFormatters::HardcodedFormatFinder GetHardcodedFormats()
Definition Language.cpp:179
static bool LanguageIsObjC(lldb::LanguageType language)
Definition Language.cpp:344
A class that handles mangled names.
Definition Mangled.h:36
ConstString GetMangledName() const
Mangled name get accessor.
Definition Mangled.h:169
ConstString GetDemangledName() const
Demangled name get accessor.
Definition Mangled.cpp:238
An error handling class.
Definition Status.h:118
A stream class that can stream formatted output to a file.
Definition Stream.h:28
size_t EOL()
Output and End of Line character to the stream.
Definition Stream.cpp:155
Defines a symbol context baton that can be handed other debug core functions.
A class that represents a running process on the host machine.
IterationAction
Useful for callbacks whose return type indicates whether to continue iteration or short-circuit.
LanguageType
Programming language type.
std::shared_ptr< lldb_private::TypeCategoryImpl > TypeCategoryImplSP
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
How to demangle a name in DemangleSymbol().
Definition Language.h:359
bool want_info
Whether to compute the DemangledNameInfo too.
Definition Language.h:361
A demangled name and, if requested, where its parts begin and end.
Definition Language.h:365
std::optional< DemangledNameInfo > info
Only computed if DemangleOptions::want_info is true.
Definition Language.h:369
std::string name
Empty if the name couldn't be demangled.
Definition Language.h:367
static void format(const lldb::LanguageType &language, llvm::raw_ostream &OS, llvm::StringRef Options)
Definition Language.cpp:640