[cfe-dev] StringLiteral->getBytes().bytes() looses leading \x00 (if non null character is in the string)

chiasa.men via cfe-dev cfe-dev at lists.llvm.org
Tue Aug 31 09:44:49 PDT 2021


Unfortunately I dont know a good way to provide a minimal working example so I
describe my problem.

If I run a clang::ast_matchers::MatchFinder::MatchCallback on StringLiterals
the matching StringLiteral somehow looses leading \x00 but only if there are
non-null chars within that string.

E.g.:
"\x00\x00\x00" will be correctly iterated with 3 times null (the
getByteLength() also correctly gives the length of 3)

"\x001\x00" will iterated as "1\x00" (also the getByteLength is 2)

How can I iterate over the leading \x00 as well?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210831/0bfbbd04/attachment.html>


More information about the cfe-dev mailing list