llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.78k stars 11.9k forks source link

clang-format breaks macro to next line #61513

Open vovagorodok opened 1 year ago

vovagorodok commented 1 year ago

For file:

#define HW_NAME "Prototype"
#define HW_VER {0, 0, 0}
#define SW_NAME "Standard"
#define SW_VER {0, 0, 0}

After -style=Chromium or any other style:

#define HW_NAME "Prototype"
#define HW_VER \
  { 0, 0, 0 }
#define SW_NAME "Standard"
#define SW_VER \
  { 0, 0, 0 }

{ 0, 0, 0 } is beaked to new line. Cant find option to disable it

llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-format

vovagorodok commented 1 year ago

Additionally it breaks line after initialization list

SteppersPositionControl::SteppersPositionControl(const SteppersKinematics& kinematics) :
    kinematics(kinematics),
    drivers{
        {STEPPER_FULL_STEPS_PER_REV, STEPPER_1_DIR, STEPPER_1_STEP},
        {STEPPER_FULL_STEPS_PER_REV, STEPPER_2_DIR, STEPPER_2_STEP}
},
    driver(drivers[0], drivers[1]), currentSteps() {
  driver.begin(steppersRpm.value(), STEPPER_MICROSTEPS);
}

Perhaps it's same issue