================
----------------
zygoloid wrote:
Pre-existing, but this looks broken too. If we lex `<foo>=` as a
non-header-name, we'll form `<` `foo` `>=`. But re-lexing as a header name will
form a `<foo>` token with `BufferPtr` pointing to the `=`. So this loop will
skip over the `>=` token and lose the `=`.
I'm not sure where we use this "dependency directives lexer", and whether it's
OK that it produces wrong results for invalid code, so maybe this is fine. (If
this is exclusively used by clang-scan-deps, maybe it's not a big deal.)
In any case, I definitely don't want you to fix this in this PR since it's
pre-existing and unrelated, but while we're here, let's add a FIXME:
```suggestion
// FIXME: This will skip too many tokens if the header-name ended in the
middle of a token, such as in '<foo>='.
while (true) {
const dependency_directives_scan::Token &NextTok =
DepDirectives.front().Tokens[NextDepDirectiveTokenIndex];
if (BufferStart + NextTok.Offset >= BufferPtr)
break;
++NextDepDirectiveTokenIndex;
}
```
https://github.com/llvm/llvm-project/pull/191004
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits