[PATCH] D28768: [clang-tidy] Add check 'modernize-return-braced-init-list'
Alexander Kornienko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 12 10:50:31 PST 2017
alexfh requested changes to this revision.
alexfh added a comment.
This revision now requires changes to proceed.
A couple of comments.
================
Comment at: clang-tidy/modernize/ReturnBracedInitListCheck.cpp:35
+
+ auto HasConstructExpr = has(ConstructExpr);
+
----------------
Nit: I see no point in this variable. I'd merge `has` into either the matcher above or the one below.
================
Comment at: clang-tidy/modernize/ReturnBracedInitListCheck.cpp:74
+ dyn_cast<VarDecl>(MatchedFunctionDecl->getParamDecl(I))) {
+ if (MatchedConstructExpr->getArg(I)->getType().getCanonicalType() !=
+ VD->getType().getCanonicalType())
----------------
I wonder whether `MatchedConstructExpr` can have fewer arguments than the declaration (e.g. when there are default arguments). Could you add a test with default arguments and check whether this code works correctly?
Repository:
rL LLVM
https://reviews.llvm.org/D28768
More information about the cfe-commits
mailing list