[PATCH] D144884: [clang-format] Only add pragma continuation indentation for 'omp' clauses

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 2 11:29:30 PST 2023


jhuber6 added a comment.

In D144884#4165192 <https://reviews.llvm.org/D144884#4165192>, @MyDeveloperDay wrote:

> without this change what does this look like?
>
>   EXPECT_EQ(
>       "#pragma omp target       \\\n"
>       "    reduction(+ : var)   \\\n"
>       "    map(to : A[0 : N])   \\\n"
>       "    map(to : B[0 : N])   \\\n"
>       "    map(from : C[0 : N]) \\\n"
>       "    firstprivate(i)      \\\n"
>       "    firstprivate(j)      \\\n"
>       "    firstprivate(k)",
>       format(
>           "#pragma omp target reduction(+:var) map(to:A[0:N]) map(to:B[0:N]) "
>           "map(from:C[0:N]) firstprivate(i) firstprivate(j) firstprivate(k)",
>           getLLVMStyleWithColumns(26)));

Like this without the code in the previous patch

  #pragma omp target reduction( \
      + : var) map(to : A       \
                       [0 : N]) \
      map(to : B[0 : N]) map(   \
          from : C[0 : N])      \
          firstprivate(i)       \
              firstprivate(     \
                  j)            \
                  firstprivate( \
                      k)

Like this if we just return the current indent without any extra

  #pragma omp target   \\
  reduction(+ : var)   \\
  map(to : A[0 : N])   \\
  map(to : B[0 : N])   \\
  map(from : C[0 : N]) \\
  firstprivate(i)      \\
  firstprivate(j)      \\
  firstprivate(k)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144884/new/

https://reviews.llvm.org/D144884



More information about the cfe-commits mailing list