llvm / llvm-project

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

C99 structs declarations indented badly #36482

Open llvmbot opened 6 years ago

llvmbot commented 6 years ago
Bugzilla Link 37134
Version 6.0
OS Linux
Attachments clang-format used
Reporter LLVM Bugzilla Contributor

Extended Description

The following struct in C begins as follows:

struct ApplicationState app_state = {
    .signal = {
        .use_crash_handler = true,
        .use_abort_handler = true,
    },
    .exit_code_on_error = {
        .python = 0,
    }
};

Afterwards:

struct ApplicationState app_state = {.signal =
                                             {
                                                     .use_crash_handler = true,
                                                     .use_abort_handler = true,
                                             },
                                     .exit_code_on_error = {
                                             .python = 0,
                                     }};

... while an exact match to the original code might not be possible. Something close should be possible.

Attached clang-format, however I don't think it's especially related to this report.

We're looking at using clang-format, RFC for context - perhaps it's of interest: https://developer.blender.org/T53211

JOE1994 commented 5 months ago

Same formatting style observed with clang-format from llvm19 trunk (a6d1366b736cad85b3bb9fbdda340e07488d6cde)

(even with .clang-format settings from Blender's github repo)