[PATCH] D54395: [clang-tidy] implement utility-function to add 'const' to variables

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 3 10:53:32 PST 2020


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


================
Comment at: clang-tools-extra/unittests/clang-tidy/AddConstTest.cpp:1055
+  EXPECT_NE(runCheckOnCode<PointeeRTransform>(Cat(S), nullptr, "input.m"),
+            Cat("Object  const*target;"));
+  EXPECT_NE(runCheckOnCode<ValueLTransform>(Cat(S), nullptr, "input.m"),
----------------
aaron.ballman wrote:
> The whitespace looks incorrect here.
It does, but it is actually how it is expected to look.
All pointer transformations create a double-blank if there was a blank before the star. My thought was, that clang-format should be used anyway, so it should do this cleanup. (especially with the -format option for clang-tidy).
The additional whitespace needs to be inserted to avoid `intconst* target;` for `int* target;` variables. Thats why it is always added, if necessary or not.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D54395





More information about the cfe-commits mailing list