Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lldb/include/lldb/Target/Language.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ class Language : public PluginInterface {

static bool LanguageIsC(lldb::LanguageType language);

static bool LanguageIsRust(lldb::LanguageType language);

/// Equivalent to \c LanguageIsC||LanguageIsObjC||LanguageIsCPlusPlus.
static bool LanguageIsCFamily(lldb::LanguageType language);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1700,7 +1700,11 @@ void DWARFASTParserClang::GetUniqueTypeNameAndDeclaration(
// For C++, we rely solely upon the one definition rule that says
// only one thing can exist at a given decl context. We ignore the
// file and line that things are declared on.
if (!die.IsValid() || !Language::LanguageIsCPlusPlus(language) ||
// For Rust, we do the same since Rust also has a similar qualified name?
// Is there a better way to do this for Rust?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would reword this to something like:
"FIXME: Rust pretends to be C++ for now, so use C++ name qualification rules"

if (!die.IsValid() ||
(!Language::LanguageIsCPlusPlus(language) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we split the language check into a separate if-statement? Makes it easier to read

!Language::LanguageIsRust(language)) ||
unique_typename.IsEmpty())
return;
decl_declaration.Clear();
Expand Down
4 changes: 4 additions & 0 deletions lldb/source/Target/Language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ bool Language::LanguageIsCPlusPlus(LanguageType language) {
}
}

bool Language::LanguageIsRust(LanguageType language) {
return language == eLanguageTypeRust;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets remove this API and just check the language type directly at the callsite for now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe eventually we'd want something like a "PretendsToBeCxx" API, which is true for rust and couple other languages. But that's out of scope

}

bool Language::LanguageIsObjC(LanguageType language) {
switch (language) {
case eLanguageTypeObjC:
Expand Down
Loading