Skip to content

Commit 248f4ed

Browse files
committed
[lldb] Fix off-by-one error in ToDwarfSourceLanguage
The ToDwarfSourceLanguage function incorrectly excluded languages that equal eLanguageTypeLastStandardLanguage. The comparison used `<` instead of `<=`, causing the last standard language to fall through to the default case and return std::nullopt. This broke language plugins that use eLanguageTypeLastStandardLanguage (currently Mojo at 0x0033) as their language code, preventing proper DWARF language conversion and breaking REPL functionality. The fix changes the comparison from `<` to `<=` to include the last standard language in the automatic conversion to DWARF source language. This is a regression from commit 7f51a2a which introduced the ToDwarfSourceLanguage function.
1 parent 631719d commit 248f4ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lldb/source/Target/Language.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ Language::~Language() = default;
549549

550550
static std::optional<llvm::dwarf::SourceLanguage>
551551
ToDwarfSourceLanguage(lldb::LanguageType language_type) {
552-
if (language_type < lldb::eLanguageTypeLastStandardLanguage)
552+
if (language_type <= lldb::eLanguageTypeLastStandardLanguage)
553553
return static_cast<llvm::dwarf::SourceLanguage>(language_type);
554554

555555
switch (language_type) {

0 commit comments

Comments
 (0)