diff options
author | Emilia Kond <emilia@rymiel.space> | 2023-09-07 22:23:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-07 22:23:05 +0300 |
commit | e9ed1aa9cd867938cd05fe76df57eb505591e81a (patch) | |
tree | bc87671dd984ee8a36ead774c8a8c4664574306e /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 80f0dc3aa4bf2097932fb789904c33d985767ecd (diff) | |
download | llvm-e9ed1aa9cd867938cd05fe76df57eb505591e81a.zip llvm-e9ed1aa9cd867938cd05fe76df57eb505591e81a.tar.gz llvm-e9ed1aa9cd867938cd05fe76df57eb505591e81a.tar.bz2 |
[clang-format] Correctly annotate designated initializer with PP if (#65409)
When encountering braces, such as those of a designated initializer,
clang-format scans ahead to see what is contained within the braces. If
it found a statement, like an if-statement of for-loop, it would deem
the braces as not an initializer, but as a block instead.
However, this heuristic incorrectly included a preprocessor `#if` line
as an if-statement. This manifested in strange results and discrepancies
between `#ifdef` and `#if defined`.
With this patch, `if` is now ignored if it is preceeded by `#`.
Fixes most of https://github.com/llvm/llvm-project/issues/56685
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions