Open aaronpuchert opened 15 hours ago
CC @serge-sans-paille.
@llvm/issue-subscribers-clang-tidy
Author: Aaron Puchert (aaronpuchert)
This is probably not easy to fix. As a pointer, StringLiteral::getLocationOfByte
uses Lexer::LexFromRawLexer
to re-lex the token. This could be used here as well: instead of StringLiteral::getBytes
iterate over the constituent tokens via tokloc_{begin,end}
and re-lex them to get their length. Then work on the original source as provided by SourceManager::getBufferData
.
However, I wonder if this warning wouldn't be better implemented right in the Lexer
itself. We already emit several Unicode warnings.
The following source has no bidirectional characters in the text:
However,
misc-misleading-bidirectional
warns that:This is likely because the check runs on the preprocessed source, where the
\x
escapes have been transformed. However, I don't think this is where we should warn, since the actual source as written is not misleading at all.