llvm-project/clang/unittests
Marek Kurdej bc40b76b5b [clang-format] Correctly parse C99 digraphs: "<:", ":>", "<%", "%>", "%:", "%:%:".
Fixes https://github.com/llvm/llvm-project/issues/31592.

This commits enables lexing of digraphs in C++11 and onwards.
Enabling them in C++03 is error-prone, as it would unconditionally treat sequences like "<:" as digraphs, even if they are followed by a single colon, e.g. "<::" would be treated as "[:" instead of "<" followed by "::". Lexing in C++11 doesn't have this problem as it looks ahead the following token.
The relevant excerpt from Lexer::LexTokenInternal:
```
        // C++0x [lex.pptoken]p3:
        //  Otherwise, if the next three characters are <:: and the subsequent
        //  character is neither : nor >, the < is treated as a preprocessor
        //  token by itself and not as the first character of the alternative
        //  token <:.
```

Also, note that both clang and gcc turn on digraphs by default (-fdigraphs), so clang-format should match this behaviour.

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

Differential Revision: https://reviews.llvm.org/D118706
2022-02-02 10:25:24 +01:00
..
AST [NFC] Remove duplicate include 2022-01-27 13:56:13 +08:00
ASTMatchers Add `isConstinit` matcher 2022-01-24 08:35:42 -05:00
Analysis [clang][dataflow] Enable comparison of distinct values in Environment 2022-02-01 15:25:59 +00:00
Basic [Clang] Extract availability mapping from VersionMap for watchOS/tvOS 2022-01-05 17:00:03 -08:00
CodeGen [clang-repl] Recommit "Land initial infrastructure for incremental parsing" 2021-05-13 06:30:29 +00:00
CrossTU Revert "[analyzer][ctu] Fix wrong 'multiple definitions' errors caused by space characters in lookup names when parsing the ctu index file" 2021-12-16 20:46:51 -05:00
DirectoryWatcher Revert "Re-Revert "DirectoryWatcher: add an implementation for Windows"" 2021-06-19 09:19:52 -07:00
Driver [clang] Fix a misadjusted path style comparison in a unittest 2021-12-09 11:47:43 +02:00
Format [clang-format] Correctly parse C99 digraphs: "<:", ":>", "<%", "%>", "%:", "%:%:". 2022-02-02 10:25:24 +01:00
Frontend [llvm] Add null-termination capability to SmallVectorMemoryBuffer 2021-12-09 11:32:13 +01:00
Index [clang] Visit enum base specifiers in libIndex 2021-10-25 13:16:14 +02:00
Interpreter [clang-repl][NFC] Fix calling convention mismatch in test 2021-11-30 13:26:10 -08:00
Introspection [AST] Fix DeclarationNameInfo introspection 2021-04-26 18:49:13 +01:00
Lex [clang][Lexer] Make raw and normal lexer behave the same for line comments 2022-01-31 16:15:16 +01:00
Rename Bump googletest to 1.10.0 2021-05-14 19:16:31 +02:00
Rewrite
Sema [NFC][Clang][test] Inclusive language: Remove and rephrase uses of sanity test/check in clang/test 2021-11-24 14:03:49 -05:00
Serialization [Frontend] Only compile modules if not already finalized 2021-07-15 18:27:08 -07:00
StaticAnalyzer [analyzer][NFC] Re-enable skipped SValTests by relaxing expectations 2022-01-19 15:16:18 +01:00
Tooling [NFC] Remove duplicate include 2022-01-27 13:56:13 +08:00
libclang [libclang] Add CXRewriter to libclang API 2020-09-04 14:17:03 -07:00
CMakeLists.txt [clang-repl] Recommit "Land initial infrastructure for incremental parsing" 2021-05-13 06:30:29 +00:00