[clang-tools-extra] [clang-tidy][modernize-return-braced-init-list]fix false-positives (PR #68491)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 7 10:28:12 PDT 2023


================
@@ -17,11 +17,21 @@ using namespace clang::ast_matchers;
 namespace clang::tidy::modernize {
 
 void ReturnBracedInitListCheck::registerMatchers(MatchFinder *Finder) {
-  // Skip list initialization and constructors with an initializer list.
+  auto SemanticallyDifferentContainer = allOf(
+      argumentCountIs(2), hasArgument(0, hasType(isInteger())),
+      hasType(cxxRecordDecl(hasAnyName("::std::vector", "::std::deque",
----------------
PiotrZSL wrote:

Probably you could include also std::string and base_string to match this constructor:
`basic_string( size_type count, CharT ch,  const Allocator& alloc = Allocator() );`

https://github.com/llvm/llvm-project/pull/68491


More information about the cfe-commits mailing list