[Lldb-commits] [lldb] [lldb][ObjC][NFCI] Replace StringLexer with llvm::StringRef (PR #172466)
Felipe de Azevedo Piovezan via lldb-commits
lldb-commits at lists.llvm.org
Wed Dec 17 02:09:44 PST 2025
================
@@ -35,31 +51,33 @@ AppleObjCTypeEncodingParser::AppleObjCTypeEncodingParser(
runtime.GetProcess()->GetTarget().GetArchitecture().GetTriple());
}
-std::string AppleObjCTypeEncodingParser::ReadStructName(StringLexer &type) {
+std::string AppleObjCTypeEncodingParser::ReadStructName(llvm::StringRef &type) {
StreamString buffer;
- while (type.HasAtLeast(1) && type.Peek() != '=')
- buffer.Printf("%c", type.Next());
+ while (!type.empty() && type.front() != '=')
+ buffer.Printf("%c", popChar(type));
+
return std::string(buffer.GetString());
}
std::optional<std::string>
-AppleObjCTypeEncodingParser::ReadQuotedString(StringLexer &type) {
- if (!type.HasAtLeast(1))
+AppleObjCTypeEncodingParser::ReadQuotedString(llvm::StringRef &type) {
+ if (type.empty())
return std::nullopt;
StreamString buffer;
- while (type.Peek() != '"') {
- buffer.Printf("%c", type.Next());
- if (!type.HasAtLeast(1))
+ while (type.front() != '"') {
+ buffer.Printf("%c", popChar(type));
----------------
felipepiovezan wrote:
I'm fairly sure you could get rid of the loop with
```
std::pair< StringRef, StringRef > split (StringRef Separator) const
```
https://github.com/llvm/llvm-project/pull/172466
More information about the lldb-commits
mailing list