[PATCH] D51949: [WIP][clang-tidy] initial ideas to isolate variable declarations

Kirill Bobyrev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 12 14:03:43 PDT 2018


kbobyrev added a comment.

I've been thinking about corner-cases (e.g. don't split `DeclStmt`s within init-statement declaration) a while and it seems that there might be many of them.

I didn't notice https://reviews.llvm.org/D27621 in the first place, it seems to have a solid test suite (and it also does some basic formatting, which is nice). It might be worthy to pick it up where it was left. Alternatively, you might want to pull the test cases from that patch if you don't want to reuse the code.



================
Comment at: clang-tidy/readability/IsolateDeclCheck.cpp:51
+
+    return TypeAndName + " = " + Initializer + ";";
+  }
----------------
JonasToth wrote:
> kbobyrev wrote:
> > This seems to replace `int x = 5, y = 42;` with `int x = 5;int y = 42`. I don't think that it becomes cleaner (in fact, without spaces in between it looks cryptic). Consider formatting it or simply applying newlines (if there were no newlines inbetween before).
> I do not plan to do a lot of formatting here (maybe space or newline), because that clang-format area.
While Clang-Tidy can apply Clang-Format on top of the Fix-Its, it will still look weird in the Fix-Its previews. While supporting proper formatting, in general, might be hard, it totally makes sense to do some basic formatting so that editor integration warnings would look better, for example.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949





More information about the cfe-commits mailing list