[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
Loading
Please sign in to comment