[PATCH] D103245: [clang-format] Fix PointerAlignmentRight with AlignConsecutiveDeclarations

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 1 14:49:49 PDT 2021


HazardyKnusperkeks added inline comments.


================
Comment at: clang/unittests/Format/FormatTest.cpp:14921
+  verifyFormat("unsigned int       *a;\n"
+               "int                *b;\n"
                "unsigned int Const *c;\n"
----------------
MyDeveloperDay wrote:
> I seem to remember in the past there was a comment from @djasper in the past that he felt you shouldn't align the * like this
> 
> I think it depends on your viewpoint as to whether the * goes with the type or the variable, this could be a religious debate, I don't think you can just assume everyone agrees with this, the fact you are changing unit tests just leaves me with alarm bells going off...
> 
> I'm not comfortable with you changing unit tests. This implies that you think its a bug, but I think the fact the test exists (Beyonce rule), means someone may have wanted to assert that behaviour. 
> 
>  Should we have an option to control this?
As far as I understand it `PAS_Right` says it should stick with the variable, and thus align this way, if we align declarations.

I think this test was this way because of the `FIXME`.


================
Comment at: clang/unittests/Format/FormatTest.cpp:15046-15048
             "  int const i   = 1;\n"
-            "  int *     j   = 2;\n"
+            "  int      *j   = 2;\n"
             "  int       big = 10000;\n"
----------------
But maybe than this should be aligned as that?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103245



More information about the cfe-commits mailing list