llvm-capstone/clang/unittests
Emilia Kond 063e3fe648
[clang-format] Skip PP directives when determining brace kind (#69473)
Pull request #65409 changed the brace kind heuristic to not treat a
preprocessor if directive as a in statement, however, this caused some
regressions.

If the contents of a brace don't immediately determine the brace kind,
the heuristic will look at the characters immediately before and after
the closing brace to determine the brace type.

Unfortunately, if the closing brace was preceded by a preprocessor
directive, for example `#endif`, the preceding token was `endif`, seen
as just an identifier, so the braces were understood as a braced list.

This patch fixes this behaviour by skipping all preprocessor directives
when calculating brace types. Comments were already being skipped, so
now preprocessor lines are skipped alongside comments.

Fixes https://github.com/llvm/llvm-project/issues/68404
2023-11-03 05:51:20 +02:00
..
Analysis [clang][dataflow][NFC] Move parseAll() to TestingSupport and rename parseFormulas() (#70437) 2023-10-31 10:04:30 +01:00
AST [clang][NFC] Refactor clang::Linkage (#71049) 2023-11-02 20:57:29 +04:00
ASTMatchers [clang][ASTMatcher] fix hasAnyBase not binding submatchers (#67939) 2023-10-16 14:09:46 -04:00
Basic [clang] Fix tests build after 537344fc 2023-10-06 15:49:57 -07:00
CodeGen Stop using legacy helpers indicating typed pointer types. NFC 2023-08-02 12:08:37 +02:00
CrossTU [clang] NFCI: Change returned AnalyzerOptions smart pointer to reference 2023-09-05 13:23:53 -07:00
DirectoryWatcher [CMake] Reduce deps 2023-04-20 08:45:38 +09:00
Driver [clang] [Gnu] Improve GCCVersion parsing to match versions such as "10-win32" (#69079) 2023-10-26 10:55:53 +03:00
Format [clang-format] Skip PP directives when determining brace kind (#69473) 2023-11-03 05:51:20 +02:00
Frontend [clang] NFCI: Use FileEntryRef in ASTReader::GetHeaderFileInfo() 2023-09-29 09:07:13 -07:00
Index [clang][index] Fix processing of CompoundAssignOperator at setting up reference roles (#69370) 2023-10-19 23:09:31 +03:00
Interpreter [JITLink][RISCV] Implement eh_frame handling (#68253) 2023-10-28 11:30:43 +02:00
Introspection [CMake] Reorder and reformat deps 2023-04-17 00:32:16 +09:00
Lex [Lex] Introduce Preprocessor::LexTokensUntilEOF() 2023-10-05 11:04:07 +02:00
libclang [libclang] Expose arguments of clang::annotate 2023-08-11 10:03:39 -04:00
Rename Bump googletest to 1.10.0 2021-05-14 19:16:31 +02:00
Rewrite
Sema [Attributes][HLSL] Teach EnumArgument to refer to an external enum (#70835) 2023-11-01 11:24:48 -07:00
Serialization [NFC] Eliminate warnings in SourceLocationEncodingTest.cpp 2023-11-02 14:01:17 +08:00
StaticAnalyzer [clang] NFCI: Change returned AnalyzerOptions smart pointer to reference 2023-09-05 13:23:53 -07:00
Support Add two time-trace scope variables. 2023-11-01 13:37:52 +00:00
Tooling [clang] Prioritze decl comments from macro expansion site (#65481) 2023-10-26 17:32:36 +01:00
CMakeLists.txt [clang] Fix linking to LLVMTestingAnnotations in standalone build 2023-01-24 13:21:24 +01:00