[Lldb-commits] [lldb] Add a new SBExpressionOptions::SetLanguage() API (NFCI) (PR #89981)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Apr 25 10:23:04 PDT 2024
================
@@ -67,6 +67,10 @@ class LLDB_API SBExpressionOptions {
void SetTrapExceptions(bool trap_exceptions = true);
void SetLanguage(lldb::LanguageType language);
+ /// Set the language using a pair of language code and version as
+ /// defined by the DWARF 6 specification.
+ /// WARNING: These codes may change until DWARF 6 is finalized.
+ void SetLanguage(uint16_t dwarf_lname_code, uint32_t dwarf_lversion);
----------------
JDevlieghere wrote:
This feels wrong. How would you feel about exposing `SourceLanguage` as `SBSourceLanguage` and having a SetLanguage overload that takes that as an argument? It seems like a small difference, but I think it conceptually makes sense to initialize an `SBSourceLanguage` with a dwarf code/version.
As an added benefit it's also more future proof, if we need to extend the class, or want to use it elsewhere in the SB API where we currently use `lldb::LanguageType`. A quick grep shows 21 instances of `lldb::LanguageType` and if we thread this through more I could imagine wanting to have the ability of passing an `SBSourceLanguage` like we do here.
https://github.com/llvm/llvm-project/pull/89981
More information about the lldb-commits
mailing list