Skip to content

Commit a0329ea

Browse files
[lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected (#144731)
Upgrade the callees of `HandleFrameFormatVariable` (`GetDemangledTemplateArguments`, etc), to return a `llvm::Expected` instead of an `std::optional`. This patch also bundles the logic of validating the demangled name and information into a single reusable function to reduce code duplication.
1 parent c594f6e commit a0329ea

File tree

3 files changed

+160
-172
lines changed

3 files changed

+160
-172
lines changed

lldb/include/lldb/Core/DemangledNameInfo.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,27 +71,28 @@ struct DemangledNameInfo {
7171

7272
/// Returns \c true if this object holds a valid basename range.
7373
bool hasBasename() const {
74+
// A function always has a name.
7475
return BasenameRange.second > BasenameRange.first;
7576
}
7677

7778
/// Returns \c true if this object holds a valid scope range.
78-
bool hasScope() const { return ScopeRange.second > ScopeRange.first; }
79+
bool hasScope() const { return ScopeRange.second >= ScopeRange.first; }
7980

8081
/// Returns \c true if this object holds a valid arguments range.
8182
bool hasArguments() const {
82-
return ArgumentsRange.second > ArgumentsRange.first;
83+
return ArgumentsRange.second >= ArgumentsRange.first;
8384
}
8485

8586
/// Returns \c true if this object holds a valid qualifiers range.
8687
bool hasQualifiers() const {
87-
return QualifiersRange.second > QualifiersRange.first;
88+
return QualifiersRange.second >= QualifiersRange.first;
8889
}
8990

9091
/// Returns \c true if this object holds a valid prefix range.
91-
bool hasPrefix() const { return PrefixRange.second > PrefixRange.first; }
92+
bool hasPrefix() const { return PrefixRange.second >= PrefixRange.first; }
9293

9394
/// Returns \c true if this object holds a valid suffix range.
94-
bool hasSuffix() const { return SuffixRange.second > SuffixRange.first; }
95+
bool hasSuffix() const { return SuffixRange.second >= SuffixRange.first; }
9596
};
9697

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

0 commit comments

Comments
 (0)