[PATCH] D28768: [clang-tidy] Add check 'modernize-return-braced-init-list'

Piotr Padlewski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 17 00:53:38 PST 2017


Prazek accepted this revision.
Prazek added a comment.
This revision is now accepted and ready to land.

Do you have some results from running it on LLVM? If nothing crashes and all fixit are correct then LGTM.



================
Comment at: clang-tidy/modernize/ReturnBracedInitListCheck.cpp:27-32
+  auto soughtConstructExpr =
+      cxxConstructExpr(unless(isListInitialization())).bind("ctor");
+
+  auto hasConstructExpr = has(ignoringImplicit(soughtConstructExpr));
+
+  auto ctorAsArgument = materializeTemporaryExpr(
----------------
Prazek wrote:
> Uppercase
Is it worth adding new variable to save 2 characters?


================
Comment at: test/clang-tidy/modernize-return-braced-init-list.cpp:106
+Bar f8 () {
+  return {};
+}
----------------
Also add test like:

return Bar{};

(If this construct is valid)


================
Comment at: test/clang-tidy/modernize-return-braced-init-list.cpp:122
+Foo f10() {
+  return f9(Bar());
+}
----------------
also make one like

return f9(Foo());




Repository:
  rL LLVM

https://reviews.llvm.org/D28768





More information about the cfe-commits mailing list