Skip to content
Commit c0779756 authored by mitchell's avatar mitchell
Browse files

[clang-format] Fix alignment in #else preprocessor blocks

Summary:
clang-format makes multiple passes when #if/#else preprocessor blocks are found.  It will make
one pass for normal code and code in the #if block, and then it will make another pass for just
the code in #else blocks. This often results in invalid alignment inside the else blocks because
they do not have any scope or indentAndNestingLevel context from their surrounding tokens/lines.

This patch remedies that by caching any initial indentAndNestingLevel from a second pass and
not breaking/returning early when a scope change is detected.

Fixes #36070

Reviewers: HazardyKnusperkeks, MyDeveloperDay

Tags: clang, clang-format

Differential Revision: https://reviews.llvm.org/D134042
parent 670cac72
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment