This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] AlignConsecutiveDeclarations fails with attributes
AbandonedPublic

Authored by MyDeveloperDay on Mar 13 2019, 2:09 PM.

Details

Summary

Addresses http://llvm.org/PR40418

When using AlignConsecutiveDeclarations: true

variables with Attributes would not be aligned correctly

void f(int  extremlylongparameternamexxxxxxxx1,
       long extremlylongparameternamexxxxxxxx2,
       int[[clang::nodiscard]] extremlylongparameternamexxxxxxxx3,
       int __attribute__((clang::nodiscard)) extremlylongparameternamexxxxxxxx4) {
  int           a;
  unsigned long b;
  int[[clang::nodiscard]] c;
  int __attribute__((clang::nodiscard)) d;
}

following this change, both parameters and variables with attributes will be aligned (space permitting)

void f(int              extremlylongparameternamexxxxxxxx1,
       long             extremlylongparameternamexxxxxxxx2,
       int              [[clang::nodiscard]] extremlylongparameternamexxxxxxxx3,
       int __attribute__((clang::nodiscard)) extremlylongparameternamexxxxxxxx4) {
  int              a;
  unsigned long    b;
  int              [[clang::nodiscard]] c;
  int __attribute__((clang::nodiscard)) d;
}

Diff Detail

Event Timeline

MyDeveloperDay created this revision.Mar 13 2019, 2:09 PM
MyDeveloperDay set the repository for this revision to rC Clang.Apr 9 2019, 12:33 AM
MyDeveloperDay edited projects, added Restricted Project; removed Restricted Project.
MyDeveloperDay removed a subscriber: llvm-commits.
klimek added inline comments.Apr 9 2019, 12:37 AM
clang/lib/Format/WhitespaceManager.cpp
468

Can you add a comment explaining the newly added startsSequences, or perhaps even pull out a function?

MyDeveloperDay abandoned this revision.Jun 20 2019, 11:17 AM