-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] add has methods to all DemangledNameInfo attributes #144549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lldb] add has methods to all DemangledNameInfo attributes #144549
Conversation
@llvm/pr-subscribers-lldb Author: Charles Zablit (charles-zablit) ChangesAdd Full diff: https://github.com/llvm/llvm-project/pull/144549.diff 1 Files Affected:
diff --git a/lldb/include/lldb/Core/DemangledNameInfo.h b/lldb/include/lldb/Core/DemangledNameInfo.h
index 4b5ba5e42b3b1..a2f3fde90c611 100644
--- a/lldb/include/lldb/Core/DemangledNameInfo.h
+++ b/lldb/include/lldb/Core/DemangledNameInfo.h
@@ -73,6 +73,25 @@ struct DemangledNameInfo {
bool hasBasename() const {
return BasenameRange.second > BasenameRange.first;
}
+
+ /// Returns \c true if this object holds a valid scope range.
+ bool hasScope() const { return ScopeRange.second > ScopeRange.first; }
+
+ /// Returns \c true if this object holds a valid arguments range.
+ bool hasArguments() const {
+ return ArgumentsRange.second > ArgumentsRange.first;
+ }
+
+ /// Returns \c true if this object holds a valid qualifiers range.
+ bool hasQualifiers() const {
+ return QualifiersRange.second > QualifiersRange.first;
+ }
+
+ /// Returns \c true if this object holds a valid prefix range.
+ bool hasPrefix() const { return PrefixRange.second > PrefixRange.first; }
+
+ /// Returns \c true if this object holds a valid suffix range.
+ bool hasSuffix() const { return SuffixRange.second > SuffixRange.first; }
};
/// An OutputBuffer which keeps a record of where certain parts of a
|
Rationale: I am working on a patch (swiftlang#10710) which adds the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if these were at least unit-tested on llvm.org, but given how trivial the implementation is, make not strictly necessary.
Agreed, if we can somehow call these in Possibly just adding another unit-test case that demangles a simple mangled name and confirms that these getters return true/false appropriately |
I ended up creating a new test suite, to isolate the checks as much as possible. This way, if someone accidentally refactors one of the |
|
||
INSTANTIATE_TEST_SUITE_P(DemangledNameInfoRangesTests, | ||
DemangledNameInfoTestFixture, | ||
::testing::ValuesIn(g_demangled_name_info_test_cases)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, that's what i had in mind. Thanks!
Add `hasX` methods to all the attributes of `DemangledNameInfo`.
Add `hasX` methods to all the attributes of `DemangledNameInfo`.
Add
hasX
methods to all the attributes ofDemangledNameInfo
.