[PATCH] D51949: [WIP][clang-tidy] initial ideas to isolate variable declarations
Jonas Toth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 17 05:10:00 PDT 2018
JonasToth marked 7 inline comments as done.
JonasToth added inline comments.
================
Comment at: clang-tidy/readability/IsolateDeclCheck.cpp:51
+
+ return TypeAndName + " = " + Initializer + ";";
+ }
----------------
kbobyrev wrote:
> 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.
The current version adds a new line for each decl and keeps the indendation (as the other check does).
Because it does the slicing on commas the manual/custom formatting of the original code will stay. That might result in weird looking output for exotic variable declarations. I would like to ignore these cases, what do you think @kbobyrev ?
================
Comment at: clang-tidy/readability/IsolateDeclCheck.h:1
+//===--- IsolateDeclCheck.h - clang-tidy-------------------------*- C++ -*-===//
+//
----------------
kbobyrev wrote:
> nit: space between clang-tidy (also, in .cpp file)
That comes from the template `add_new_check.py`, do you want me to fix it there?
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D51949
More information about the cfe-commits
mailing list