================
@@ -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));
+
+ if (type.empty())
return std::nullopt;
}
return std::string(buffer.GetString());
}
-uint32_t AppleObjCTypeEncodingParser::ReadNumber(StringLexer &type) {
+uint32_t AppleObjCTypeEncodingParser::ReadNumber(llvm::StringRef &type) {
uint32_t total = 0;
- while (type.HasAtLeast(1) && isdigit(type.Peek()))
- total = 10 * total + (type.Next() - '0');
+ while (!type.empty() && isdigit(type.front()))
+ total = 10 * total + (popChar(type) - '0');
----------------
felipepiovezan wrote:
FYI:
```
bool StringRef::consumeInteger (unsigned Radix, T &Result)
Parse the current string as an integer of the specified radix.
If Radix is specified as zero, this does radix autosensing using extended C
rules: 0 is octal, 0x is hex, 0b is binary.
If the string does not begin with a number of the specified radix, this returns
true to signify the error. The string is considered erroneous if empty or if it
overflows T. The portion of the string representing the discovered numeric
value is removed from the beginning of the string.
Definition at line
[501](https://llvm.org/doxygen/StringRef_8h_source.html#l00501) of file
[StringRef.h](https://llvm.org/doxygen/StringRef_8h_source.html).
```
https://github.com/llvm/llvm-project/pull/172466
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits