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

Malcolm Parsons via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 16 05:06:28 PST 2017


malcolm.parsons added a comment.

`{}` doesn't allow narrowing; can you check for that?



================
Comment at: clang-tidy/modernize/ReturnBracedInitListCheck.cpp:50
+  SourceLocation Loc = MatchedConstructExpr->getExprLoc();
+  if (Loc.isMacroID())
+    return;
----------------
Test?


================
Comment at: clang-tidy/modernize/ReturnBracedInitListCheck.cpp:56
+  const QualType constructType = MatchedConstructExpr->getType();
+  if (returnType != constructType)
+    return;
----------------
Test?


================
Comment at: clang-tidy/modernize/ReturnBracedInitListCheck.cpp:65
+  // Return if there is no explicit constructor call.
+  if (CallParensRange.isInvalid())
+    return;
----------------
Test?


================
Comment at: clang-tidy/modernize/ReturnBracedInitListCheck.cpp:68
+
+  Diag << FixItHint::CreateRemoval(MatchedConstructExpr->getLocStart());
+  Diag << FixItHint::CreateReplacement(
----------------
What happens for multi-token types like `vector<int>`?


Repository:
  rL LLVM

https://reviews.llvm.org/D28768





More information about the cfe-commits mailing list