[PATCH] D145262: [clang-format] Treat AttributeMacros more like attribute macros

Jared Grubb via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 23 15:17:54 PDT 2023


jaredgrubb marked an inline comment as done.
jaredgrubb added inline comments.


================
Comment at: clang/unittests/Format/FormatTestObjC.cpp:1619
+  // Reflow after first macro.
+  // FIXME: these should indent but don't.
+  verifyFormat("- (id)init ATTRIBUTE_MACRO(X)\n"
----------------
owenpan wrote:
> jaredgrubb wrote:
> > I don't love this FIXME, but I was afraid to add more to this patch, as fixing this will require digging into things that have nothing to do with `__attribute__` vs `AttributeMacros`.
> > 
> > For example, suffix macros in C/C++ also are broken in the same way with just plain `__attribute__`. For example, for `ColumnWidth: 50`:
> > ```
> > int f(double) __attribute__((overloadable))
> > __attribute__((overloadable));
> > 
> > int ffffffffffffffffffffffffffffff(double)
> >     __attribute__((overloadable))
> >     __attribute__((overloadable));
> > ```
> > 
> > I think fixing reflowing of suffix macros is best done in another PR (which I can take a stab at!)
> Half of the test cases passed before this patch but now would fail with this patch. That is, this patch would generate regressions.
Just saw this comment. Yes, 3 of these did pass, but lots more in this file do NOT pass. I understand the desire to not "regress", but this patch improves so many other examples (as documented in these test cases). I can pick some of the worst if it helps, but otherwise, I'm not sure what I can do to address your comment.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145262/new/

https://reviews.llvm.org/D145262



More information about the cfe-commits mailing list