[Lldb-commits] [lldb] [lldb] Mark single-argument SourceLanguage constructors explicit (PR #166527)
Adrian Prantl via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 5 08:26:06 PST 2025
================
@@ -102,18 +102,24 @@ struct RegisterSet {
/// A type-erased pair of llvm::dwarf::SourceLanguageName and version.
struct SourceLanguage {
SourceLanguage() = default;
- SourceLanguage(lldb::LanguageType language_type);
+ explicit SourceLanguage(lldb::LanguageType language_type);
+
SourceLanguage(uint16_t name, uint32_t version)
: name(name), version(version) {}
- SourceLanguage(std::optional<std::pair<uint16_t, uint32_t>> name_vers)
+
+ explicit SourceLanguage(
+ std::optional<std::pair<uint16_t, uint32_t>> name_vers)
: name(name_vers ? name_vers->first : 0),
version(name_vers ? name_vers->second : 0) {}
- operator bool() const { return name > 0; }
+
+ explicit operator bool() const { return name > 0; }
+
lldb::LanguageType AsLanguageType() const;
llvm::StringRef GetDescription() const;
bool IsC() const;
bool IsObjC() const;
bool IsCPlusPlus() const;
+ bool IsSwift() const;
----------------
adrian-prantl wrote:
FWIW, the Is... accessors made sense for merged languages like ObjC++, but Swift only has one dialect, so we could just compare the LNAME?
https://github.com/llvm/llvm-project/pull/166527
More information about the lldb-commits
mailing list