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

Jonas Devlieghere via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 16 03:40:35 PST 2017


JDevlieghere created this revision.
JDevlieghere added reviewers: hokein, Prazek, aaron.ballman, alexfh.
JDevlieghere added a subscriber: cfe-commits.
JDevlieghere set the repository for this revision to rL LLVM.
JDevlieghere added a project: clang-tools-extra.
Herald added a subscriber: mgorny.

Replaces explicit calls to the constructor in a return with a braced
initializer list. This way the return type is not needlessly duplicated in the
return type and the return statement.

  Foo bar() {
    Baz baz;
    return Foo(baz);
  }
  
  // transforms to:
  
  Foo bar() {
    Baz baz;
    return {baz};
  }


Repository:
  rL LLVM

https://reviews.llvm.org/D28768

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/ReturnBracedInitListCheck.cpp
  clang-tidy/modernize/ReturnBracedInitListCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-return-braced-init-list.rst
  test/clang-tidy/modernize-return-braced-init-list.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28768.84541.patch
Type: text/x-patch
Size: 8603 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170116/e29f54e6/attachment-0001.bin>


More information about the cfe-commits mailing list