diff options
| author | Jonas Devlieghere <jonas@devlieghere.com> | 2017-02-15 17:06:06 +0000 |
|---|---|---|
| committer | Jonas Devlieghere <jonas@devlieghere.com> | 2017-02-15 17:06:06 +0000 |
| commit | 278904317849409f6967da57d784918d35b28739 (patch) | |
| tree | 5b92c9785a00e11c6556883f8eda1988ac69a066 /clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp | |
| parent | 0ac6d124cfacebb844d5cc2b9f3b81c2f7b80a16 (diff) | |
| download | bcm5719-llvm-278904317849409f6967da57d784918d35b28739.tar.gz bcm5719-llvm-278904317849409f6967da57d784918d35b28739.zip | |
[clang-tidy] Add check 'modernize-return-braced-init-list'
Summary:
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};
}
```
Reviewers: hokein, Prazek, aaron.ballman, alexfh
Reviewed By: Prazek, aaron.ballman, alexfh
Subscribers: malcolm.parsons, mgorny, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D28768
llvm-svn: 295199
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp index 3274f5d60b4..0328d1876da 100644 --- a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp @@ -19,6 +19,7 @@ #include "RawStringLiteralCheck.h" #include "RedundantVoidArgCheck.h" #include "ReplaceAutoPtrCheck.h" +#include "ReturnBracedInitListCheck.h" #include "ShrinkToFitCheck.h" #include "UseAutoCheck.h" #include "UseBoolLiteralsCheck.h" @@ -53,6 +54,8 @@ public: "modernize-redundant-void-arg"); CheckFactories.registerCheck<ReplaceAutoPtrCheck>( "modernize-replace-auto-ptr"); + CheckFactories.registerCheck<ReturnBracedInitListCheck>( + "modernize-return-braced-init-list"); CheckFactories.registerCheck<ShrinkToFitCheck>("modernize-shrink-to-fit"); CheckFactories.registerCheck<UseAutoCheck>("modernize-use-auto"); CheckFactories.registerCheck<UseBoolLiteralsCheck>( |

