Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-format fails to detect trailing return syntax within a macro #47664

Closed
chandlerc opened this issue Nov 28, 2020 · 1 comment
Closed

clang-format fails to detect trailing return syntax within a macro #47664

chandlerc opened this issue Nov 28, 2020 · 1 comment
Labels
bugzilla Issues migrated from bugzilla clang-format

Comments

@chandlerc
Copy link
Member

Bugzilla Link 48320
Version unspecified
OS All

Extended Description

Given:

auto TestWithoutMacro() -> int { return 42; }

#define SOME_X_MACRO(NAME) \
  auto NAME() -> int { return 42; }

SOME_X_MACRO(TestWithMacro)

Running clang-format --style=Google test.cpp produces:

auto TestWithoutMacro() -> int { return 42; }

#define SOME_X_MACRO(NAME) \
  auto NAME()->int { return 42; }

SOME_X_MACRO(TestWithMacro)

The -> inside the macro body should retain the spaces around it, as this isn't a member access, this is a trailing return type.

This may be related to #41495 but is pretty clearly different from #42180 which is mentioned there.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@rymiel
Copy link
Member

rymiel commented Jan 16, 2023

Patch: https://reviews.llvm.org/D141811

@rymiel rymiel added the awaiting-review Has pending Phabricator review label Jan 16, 2023
@rymiel rymiel closed this as completed in c70e360 Mar 23, 2023
@github-actions github-actions bot removed the awaiting-review Has pending Phabricator review label Mar 23, 2023
github-merge-queue bot pushed a commit to carbon-language/carbon-lang that referenced this issue Dec 7, 2023
This apparently includes a fix for
llvm/llvm-project#47664 (previously
https://bugs.llvm.org/show_bug.cgi?id=48320)

Note this continues with a clang-format version that's different from
the compiler versions we're often using, but the differences in
formatting seem worthwhile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang-format
Projects
None yet
Development

No branches or pull requests

3 participants