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

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 12 10:50:07 PDT 2018


JonasToth added inline comments.


================
Comment at: clang-tidy/readability/IsolateDeclCheck.cpp:35
+
+  std::string TypeAndName =
+      VarType.getAsString(TypePrinter) + " " + D->getNameAsString();
----------------
kbobyrev wrote:
> `llvm::Twine` here? Seems like this one is used a lot for concatenation, so just `.str()` when returning.
the logic already changed (but i did not update the diff, because its still super prototype).
Maybe i go to `Twine`, but i want it do be more a utility function that can be used in other checks that want to do type transformations.


================
Comment at: clang-tidy/readability/IsolateDeclCheck.cpp:51
+
+    return TypeAndName + " = " + Initializer + ";";
+  }
----------------
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.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949





More information about the cfe-commits mailing list