Skip to content

Conversation

@Michael137
Copy link

We had a dedicated StringLexer class that pretty much just replicates the llvm::StringRef interface. This patch removes the StringLexer in favour of just using llvm::StringRef. Much of the string parsing can be cleaned up, but I tried to keep the changes a small as possible so just kept the logic and replaced the APIs calls. The only awkward side-effect of this is that we have to pass a llvm::StringRef & around.

There were some gaps in the API, so added two helper methods to consume/pop off characters from the front of the StringRef (maybe those can be added to llvm::StringRef in the future).

The StringLexer also had a roll-back mechanism used in two places. That can be handled by just saving a copy of the StringRef.

(cherry picked from commit e4c4498)

)

We had a dedicated `StringLexer` class that pretty much just replicates
the `llvm::StringRef` interface. This patch removes the `StringLexer` in
favour of just using `llvm::StringRef`. Much of the string parsing can
be cleaned up, but I tried to keep the changes a small as possible so
just kept the logic and replaced the APIs calls. The only awkward
side-effect of this is that we have to pass a `llvm::StringRef &`
around.

There were some gaps in the API, so added two helper methods to
consume/pop off characters from the front of the StringRef (maybe those
can be added to `llvm::StringRef` in the future).

The `StringLexer` also had a roll-back mechanism used in two places.
That can be handled by just saving a copy of the `StringRef`.

(cherry picked from commit e4c4498)
@Michael137 Michael137 requested a review from a team as a code owner December 17, 2025 14:38
@Michael137
Copy link
Author

@swift-ci test

@adrian-prantl adrian-prantl merged commit 97f322e into swift/release/6.3 Dec 17, 2025
3 checks passed
@adrian-prantl adrian-prantl deleted the lldb/string-lexer-nfc-to-6.3 branch December 17, 2025 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants