[clang-format] Fix mis-attributing preprocessor directives to macros
authorJacob Abraham <jacob.r.abraham@gmail.com>
Tue, 11 Oct 2022 02:57:17 +0000 (19:57 -0700)
committerowenca <owenpiano@gmail.com>
Tue, 11 Oct 2022 02:57:58 +0000 (19:57 -0700)
commitb0758f62afb6945edfb2046da10b338bb6ced474
tree6b61f0612d96ff1bece2b0e7ef0657263faf8779
parent1d4238be528acdd8a521465e93ed6a6238a2cd4e
[clang-format] Fix mis-attributing preprocessor directives to macros

This solves the issue where a case statement inside a macro greedily
adds preprocessor lines such as #include to the macro even if they
are not a part of the macro to begin with.

Fixes #58214.

Differential Revision: https://reviews.llvm.org/D135422
clang/lib/Format/UnwrappedLineFormatter.cpp
clang/unittests/Format/FormatTest.cpp