This patch adds parseBase64Bytes to the parser. It attempts to avoid double-allocating the buffer by re-using the token's spelling directly and eliding the quotes if they exist. It also avoids extra allocations by using std::vector<char> in the API - something we should change when the llvm::decodeBase64 API changes.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/AsmParser/AsmParserImpl.h | ||
---|---|---|
262 | Why does this need to trim whitespace? I'd just consume the string characters and let decodeBase64 error out as necessary. |
mlir/lib/AsmParser/AsmParserImpl.h | ||
---|---|---|
262 | It's because we're using the token spelling directly, so I couldn't actually get *any* example to work without trim whitespace and trimming the quotes. If you use token.getStringValue() then it works without trimming, so it's a tradeoff between double-allocating the buffer and having to trim. |
mlir/lib/AsmParser/AsmParserImpl.h | ||
---|---|---|
262 | I'm happy to revisit this and go the other way if you'd prefer :) |
Why does this need to trim whitespace? I'd just consume the string characters and let decodeBase64 error out as necessary.