[all-commits] [llvm/llvm-project] 466b43: [clang-format] Only add pragma continuation indent...

Joseph Huber via All-commits all-commits at lists.llvm.org
Tue Feb 28 13:16:00 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 466b4327f8fcaf82178b02dffc66a5ff11a150d4
      https://github.com/llvm/llvm-project/commit/466b4327f8fcaf82178b02dffc66a5ff11a150d4
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2023-02-28 (Tue, 28 Feb 2023)

  Changed paths:
    M clang/lib/Format/ContinuationIndenter.cpp
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list