Skip to content

proper indention for goto destination pointΒ #24492

@llvmbot

Description

@llvmbot
Bugzilla Link 24118
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @mitchblank,@tromey

Extended Description

When using clang format based on google style.

It reformat the following code to

int main() {
  for (int i = 1; i < 10; i++)
    for (int j = 0; j < 5; j++) {
      // do something
      goto end_double_loop;
    }
end_double_loop : {}

  return 0;
}

Could someone add a clang format style options so the "end_double_loop" will be aligned to the first for loop instead of int main? Meaning the desired format is

int main() {
  for (int i = 1; i < 10; i++)
    for (int j = 0; j < 5; j++) {
      // do something
      goto end_double_loop;
    }
  end_double_loop : {}

  return 0;
}

Thanks,
Jason

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang-formatgood first issuehttps://github.com/llvm/llvm-project/contribute

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions