aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorsstwcw <su3e8a96kzlver@posteo.net>2025-07-21 15:40:28 +0000
committerGitHub <noreply@github.com>2025-07-21 15:40:28 +0000
commit12a3afe47d4e5fcc97eb44271c00ace7cc8e4ff2 (patch)
tree989683ad4c32bfcaae9d27b959dcef2db7358e6a /llvm/lib
parented2bfd132509da679320a1d691af4a91192297d0 (diff)
downloadllvm-12a3afe47d4e5fcc97eb44271c00ace7cc8e4ff2.zip
llvm-12a3afe47d4e5fcc97eb44271c00ace7cc8e4ff2.tar.gz
llvm-12a3afe47d4e5fcc97eb44271c00ace7cc8e4ff2.tar.bz2
[clang-format] Remove code related to trigraphs (#148640)
When reviewing #147156, the reviewers pointed out that we didn't need to support the trigraph. The code never handled it right. In the debug build, this kind of input caused the assertion in the function `countLeadingWhitespace` to fail. The release build without assertions outputted `?` `?` `/` separated by spaces. ```C #define A ??/ int i; ``` This is because the code in `countLeadingWhitespace` assumed that the underlying lexer recognized the entire `??/` sequence as a single token. In fact, the lexer recognized it as 3 separate tokens. The flag to make the lexer recognize trigraphs was never enabled. This patch enables the flag in the underlying lexer. This way, the program now either turns the trigraph into a single `\` or removes it altogether if the line is short enough. There are operators like the `??=` in C#. So the flag is not enabled for all input languages. Instead the check for the token size is moved from the assert line into the if line. The problem was introduced by my own patch 370bee480139 from about 3 years ago. I added code to count the number of characters in the escape sequence probably just because the block of code used to have a comment saying someone should add the feature. Maybe I forgot to enable assertions when I ran the code. I found the problem because reviewing pull request 145243 made me look at the code again.
Diffstat (limited to 'llvm/lib')
0 files changed, 0 insertions, 0 deletions