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]: macros can cause formatting to remove spaces #122299

Closed
proximities opened this issue Jan 9, 2025 · 4 comments
Closed

[clang-format]: macros can cause formatting to remove spaces #122299

proximities opened this issue Jan 9, 2025 · 4 comments
Labels
clang-format question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

Comments

@proximities
Copy link

macros can cause formatting to remove spaces sometimes. for example

   for (auto [name, format] : targetMap)

is fine, but with a macro #define var auto, clang formats behaves like this

   #define var auto
   for (var[name, format] : targetMap)
@llvmbot
Copy link
Member

llvmbot commented Jan 9, 2025

@llvm/issue-subscribers-clang-format

Author: None (proximities)

macros can cause formatting to remove spaces sometimes. for example ``` for (auto [name, format] : targetMap) ```

is fine, but with a macro #define var auto, clang formats behaves like this

   #define var auto
   for (var[name, format] : targetMap)

@mydeveloperday
Copy link
Contributor

Did you try and of the "Macro's" settings telling clang-format that var was a macro?

@mydeveloperday
Copy link
Contributor

please create a minimal .clang-format file and .cpp file that exibits this issue

@EugeneZelenko EugeneZelenko added the incomplete Issue not complete (e.g. missing a reproducer, build arguments, etc.) label Jan 10, 2025
@proximities
Copy link
Author

Using Macros: [var=auto] allows clang-format to disable formatting, which solves the issue. Thanks!

@EugeneZelenko EugeneZelenko added question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead! and removed incomplete Issue not complete (e.g. missing a reproducer, build arguments, etc.) labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang-format question A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Projects
None yet
Development

No branches or pull requests

4 participants