llvm-project/clang/unittests/Format
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
..
CMakeLists.txt [clang-format] Style to separate definition blocks 2022-01-03 15:47:39 -05:00
CleanupTest.cpp [clang-format] Drop clangFrontend dependency for FormatTests 2020-10-20 10:13:28 +01:00
DefinitionBlockSeparatorTest.cpp [clang-format] Fix SeparateDefinitionBlocks issues 2022-01-24 14:23:20 +00:00
FormatTest.cpp [clang-format] Correctly parse C99 digraphs: "<:", ":>", "<%", "%>", "%:", "%:%:". 2022-02-02 10:25:24 +01:00
FormatTestCSharp.cpp [clang-format] Fix short functions being considered as inline inside an indented namespace. 2022-01-14 21:57:02 +01:00
FormatTestComments.cpp [clang-format] Fix misaligned trailing comments in the presence of an empty block comment. 2022-01-28 22:28:48 +01:00
FormatTestJS.cpp [clang-format] Move irrelevant code from getRangeLength to getRemainingLength. NFC. 2022-01-28 12:01:02 +01:00
FormatTestJava.cpp [clang-format] Fix short functions being considered as inline inside an indented namespace. 2022-01-14 21:57:02 +01:00
FormatTestJson.cpp [clang-format] Remove spurious JSON binding when DisableFormat = true 2021-12-15 23:09:28 +00:00
FormatTestObjC.cpp [clang-format] [PR52015] clang-format should put __attribute__((foo)) on its own line before @interface / @implementation / @protocol 2021-10-20 09:09:31 +01:00
FormatTestProto.cpp [clang-format] NFC - clang-format the FormatTests 2020-05-02 15:42:20 +01:00
FormatTestRawStrings.cpp clang-format: use `pb` as a canonical raw string delimiter for google style 2021-03-09 09:07:14 +01:00
FormatTestSelective.cpp [clang-format] NFC - clang-format the FormatTests 2020-05-02 15:42:20 +01:00
FormatTestTableGen.cpp
FormatTestTextProto.cpp [clang-format] Indicate source location on test failure. NFC. 2022-01-20 14:10:59 +01:00
FormatTestUtils.h
MacroExpanderTest.cpp [clang-format] [NFC] keep clang-format tests clang-format clean 2020-12-05 10:15:52 +00:00
NamespaceEndCommentsFixerTest.cpp [clang-format] Fix namespace end comments fixer with anonymous namespaces. 2022-01-14 11:41:14 +01:00
QualifierFixerTest.cpp [clang-format] Fix a crash (assertion) in qualifier alignment when matching template closer is null 2022-01-06 19:40:39 +00:00
SortImportsTestJS.cpp clang-format: [JS] sort import aliases. Users can define aliases for long symbols using import aliases: 2022-01-28 11:51:28 +01:00
SortImportsTestJava.cpp [clang-format] Add case aware include sorting. 2021-02-02 15:12:27 +01:00
SortIncludesTest.cpp [clang-format] Don't break block comments when sorting includes. 2022-02-01 08:51:10 +01:00
TestLexer.h [clang-format] [NFC] Fix the coding style of unit tests header file 2021-08-27 14:25:38 -07:00
TokenAnnotatorTest.cpp [clang-format] Fix AllowShortFunctionsOnASingleLine: InlineOnly with wrapping after record. 2022-01-27 18:06:31 +01:00
UsingDeclarationsSorterTest.cpp [clang-format] NFC - clang-format the FormatTests 2020-05-02 15:42:20 +01:00