[clang-format] Only add pragma continuation indentation for 'omp' clauses
authorJoseph Huber <jhuber6@vols.utk.edu>
Mon, 27 Feb 2023 16:35:30 +0000 (10:35 -0600)
committerJoseph Huber <jhuber6@vols.utk.edu>
Tue, 28 Feb 2023 21:15:44 +0000 (15:15 -0600)
commit466b4327f8fcaf82178b02dffc66a5ff11a150d4
tree26650788ea56202f6b484c8001e59a839a4047c8
parent849529ba8a2e155cd90b0641bcf20bc566222db6
[clang-format] Only add pragma continuation indentation for 'omp' clauses

The patch in D136100 added custom handling for pragmas to assist in
formatting OpenMP clauses correctly. One of these changes added extra
indentation. This is desirable for OpenMP pragmas as they are several
complete tokens that would otherwise we on the exact same line. However,
this is not desired for the other pragmas.

This solution is extremely hacky, I'm not overly familiar with the
`clang-format` codebase. A better solution would probably require
actually parsing these as tokens, but I just wanted to propose a
solution.

Fixes https://github.com/llvm/llvm-project/issues/59473

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D144884
clang/lib/Format/ContinuationIndenter.cpp
clang/unittests/Format/FormatTest.cpp