Skip to content

[clang-format] Tabular alignment based on internal operators #191320

@nabelekt

Description

@nabelekt

clang-format does a good job aligning consecutive lines based on assignment operators, but doesn't seem to have any support for other operators after that in a set in given lines. I am trying to make

frame |= (static_cast<uint64_t>(alisufh) & 0xFULL) << 0U;
frame |= (static_cast<uint64_t>(awoeufhldsiuahloiwef) & 0x1ULL) << 4U;
frame |= (static_cast<uint64_t>(asdf) & 0x1ULL) << 5U;
frame |= (static_cast<uint64_t>(oasiudhoaw9ufheoaweufhw) & 0x1ULL) << 6U;
frame |= (static_cast<uint64_t>(auisgfydoayasdfasdf) & 0x1ULL) << 7U;
frame |= (static_cast<uint64_t>(hasdfadsfadsf) & 0x1ULL) << 8U;
frame |= (static_cast<uint64_t>(asdfas) & 0x1ULL) << 9U;
frame |= (static_cast<uint64_t>(biushdfus) & 0x1ULL) << 10U;

look like

frame |= (static_cast<uint64_t>(alisufh)                 & 0xFULL) <<  0U;
frame |= (static_cast<uint64_t>(awoeufhldsiuahloiwef)    & 0x1ULL) <<  4U;
frame |= (static_cast<uint64_t>(asdf)                    & 0x1ULL) <<  5U;
frame |= (static_cast<uint64_t>(oasiudhoaw9ufheoaweufhw) & 0x1ULL) <<  6U;
frame |= (static_cast<uint64_t>(auisgfydoayasdfasdf)     & 0x1ULL) <<  7U;
frame |= (static_cast<uint64_t>(hasdfadsfadsf)           & 0x1ULL) <<  8U;
frame |= (static_cast<uint64_t>(asdfas)                  & 0x1ULL) <<  9U;
frame |= (static_cast<uint64_t>(biushdfus)               & 0x1ULL) << 10U;

(the digit-based number alignment at the end is probably a different issue).

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions