[PATCH] D144709: [clang-format] Improve QualifierAlignment

Alexander Hederstaf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 1 01:50:44 PST 2023


AlexanderHederstaf added a comment.

This code from llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp failed with **Right** but without a full list of specifiers. As **static** was not configured, the } was not discovered by **IsRightQualifier**. Changed some of the qualifier tests to check against the full list instead.

  struct ExecutionClass {
    ExecutionMode Mask;
    const char *Description;
  } static const kExecutionClasses[] = {
      {ExecutionMode::ALWAYS_SERIAL_IMPLICIT_REGS_ALIAS |
           ExecutionMode::ALWAYS_SERIAL_TIED_REGS_ALIAS,
       "Repeating a single implicitly serial instruction"},
      {ExecutionMode::SERIAL_VIA_EXPLICIT_REGS,
       "Repeating a single explicitly serial instruction"},
      {ExecutionMode::SERIAL_VIA_MEMORY_INSTR |
           ExecutionMode::SERIAL_VIA_NON_MEMORY_INSTR,
       "Repeating two instructions"},
  };

Resulted in

  } static kExecutionClasses const[] = {

Which is now fixed. This struct will be left unchanged as with other structs.

I ran clang format on all files in clang/ and llvm/, where I had added QualifierAlignment: Right to any .clang-format. I built with

  cmake -S llvm -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang"
  cmake --build build

Is that sufficient or did you imagine some other build?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144709



More information about the cfe-commits mailing list