This is extends bb5afd3c to cover warnings emitted during lexing. This implements another part of #10752