llvm-project/clang
mitchell c0779756a0 [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
2022-09-27 15:41:09 -04:00
..
bindings Add clang_CXXMethod_isDeleted function 2022-09-21 11:12:48 -04:00
cmake [CMake] Add `CLANG_ENABLE_HLSL` CMake option 2022-09-27 12:33:22 -05:00
docs [AArch64] Add Neoverse V2 CPU support 2022-09-27 07:56:08 +00:00
examples
include [NFC][Clang] Remove dead code 2022-09-26 18:32:52 -07:00
lib [clang-format] Fix alignment in #else preprocessor blocks 2022-09-27 15:41:09 -04:00
runtime Revert "[cmake] Use `CMAKE_INSTALL_LIBDIR` too" 2022-08-18 22:46:32 -04:00
test [Clang][OpenMP] Fix run time crash when use_device_addr is used. 2022-09-27 11:53:57 -07:00
tools [CMake] Add `CLANG_ENABLE_HLSL` CMake option 2022-09-27 12:33:22 -05:00
unittests [clang-format] Fix alignment in #else preprocessor blocks 2022-09-27 15:41:09 -04:00
utils [CMake] Add clang-bolt target 2022-09-23 10:10:31 +02:00
www Update the status of a few more C99 DRs 2022-09-26 08:20:56 -04:00
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt [CMake] Add `CLANG_ENABLE_HLSL` CMake option 2022-09-27 12:33:22 -05:00
CodeOwners.rst Update the clang and clang-tools-extra code owners files 2022-09-06 08:28:03 -04:00
INSTALL.txt
LICENSE.TXT
ModuleInfo.txt
NOTES.txt
README.txt

README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source-level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:             http://clang.llvm.org/
Building and using Clang:         http://clang.llvm.org/get_started.html
Clang Static Analyzer:            http://clang-analyzer.llvm.org/
Information on the LLVM project:  http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang forums:
  https://discourse.llvm.org/c/clang/

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/