Skip to content

Commit 602eaca

Browse files
fix failing test
1 parent bc82236 commit 602eaca

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

lldb/include/lldb/Core/DemangledNameInfo.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,48 @@ struct DemangledNameInfo {
7474
return BasenameRange.second > BasenameRange.first;
7575
}
7676

77+
/// Returns \c true if `BasenameRange` is empty.
78+
bool isBasenameEmpty() const {
79+
return BasenameRange.first == BasenameRange.second;
80+
}
81+
7782
/// Returns \c true if this object holds a valid scope range.
7883
bool hasScope() const { return ScopeRange.second > ScopeRange.first; }
7984

85+
/// Returns \c true if `ScopeRange` is empty.
86+
bool isScopeEmpty() const { return ScopeRange.first == ScopeRange.second; }
87+
8088
/// Returns \c true if this object holds a valid arguments range.
8189
bool hasArguments() const {
8290
return ArgumentsRange.second > ArgumentsRange.first;
8391
}
8492

93+
/// Returns \c true if `ArgumentsRange` is empty.
94+
bool isArgumentsEmpty() const {
95+
return ArgumentsRange.first == ArgumentsRange.second;
96+
}
97+
8598
/// Returns \c true if this object holds a valid qualifiers range.
8699
bool hasQualifiers() const {
87100
return QualifiersRange.second > QualifiersRange.first;
88101
}
89102

103+
/// Returns \c true if `QualifiersRange` is empty.
104+
bool isQualifiersEmpty() const {
105+
return QualifiersRange.first == QualifiersRange.second;
106+
}
107+
90108
/// Returns \c true if this object holds a valid prefix range.
91109
bool hasPrefix() const { return PrefixRange.second > PrefixRange.first; }
92110

111+
/// Returns \c true if `PrefixRange` is empty.
112+
bool isPrefixEmpty() const { return PrefixRange.first == PrefixRange.second; }
113+
93114
/// Returns \c true if this object holds a valid suffix range.
94115
bool hasSuffix() const { return SuffixRange.second > SuffixRange.first; }
116+
117+
/// Returns \c true if `SuffixRange` is empty.
118+
bool isSuffixEmpty() const { return SuffixRange.first == SuffixRange.second; }
95119
};
96120

97121
/// An OutputBuffer which keeps a record of where certain parts of a

lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ GetDemangledFunctionQualifiers(const SymbolContext &sc) {
314314

315315
auto [demangled_name, info] = *info_or_err;
316316

317-
if (!info.hasQualifiers())
317+
if (!info.hasQualifiers() && !info.isQualifiersEmpty())
318318
return llvm::createStringError("Qualifiers range for '%s' is invalid.",
319319
demangled_name.data());
320320

@@ -347,7 +347,7 @@ GetDemangledScope(const SymbolContext &sc) {
347347

348348
auto [demangled_name, info] = *info_or_err;
349349

350-
if (!info.hasScope())
350+
if (!info.hasScope() && !info.isScopeEmpty())
351351
return llvm::createStringError("Scope range for '%s' is invalid.",
352352
demangled_name.data());
353353

@@ -364,7 +364,7 @@ GetDemangledFunctionSuffix(const SymbolContext &sc) {
364364

365365
auto [demangled_name, info] = *info_or_err;
366366

367-
if (!info.hasSuffix())
367+
if (!info.hasSuffix() && !info.isSuffixEmpty())
368368
return llvm::createStringError("Suffix range for '%s' is invalid.",
369369
demangled_name.data());
370370

0 commit comments

Comments
 (0)