================
@@ -81,21 +100,28 @@ llvm::Expected<Token> DILLexer::Lex(llvm::StringRef expr,
return Token(Token::eof, "", (uint32_t)expr.size());
uint32_t position = cur_pos - expr.begin();
+ std::optional<llvm::StringRef> maybe_number = IsNumber(expr, remainder);
+ if (maybe_number) {
+ std::string number = (*maybe_number).str();
+ return Token(Token::numeric_constant, number, position);
+ }
----------------
labath wrote:
```suggestion
if (maybe_number)
return Token(Token::numeric_constant, maybe_number->str(), position);
```
mainly because it avoids making a copy of the std::string object (without
resorting to std::move)
https://github.com/llvm/llvm-project/pull/138551
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits