[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 15:04:29 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())),
----------------
PiotrZSL wrote:

In short yes, but we would need to somehow check a type, this mean find if there is constructor with std::initializer_list, read template type, and compare it against type we pass, or type we use. 

Simply to still find issues when types wound not match and conversion woudn't be done anyway.

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


More information about the cfe-commits mailing list