================
@@ -0,0 +1,78 @@
+//===--- MakeFunctionToDirectCheck.cpp - clang-tidy ----------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "MakeFunctionToDirectCheck.h"
+#include "../utils/TransformerClangTidyCheck.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
+#include "clang/Tooling/Transformer/RangeSelector.h"
+#include "clang/Tooling/Transformer/RewriteRule.h"
+#include "clang/Tooling/Transformer/Stencil.h"
+
+using namespace ::clang::ast_matchers;
+using namespace ::clang::transformer;
+
+namespace clang::tidy::modernize {
+
+namespace {
+
+RewriteRuleWith<std::string>
+makeFunctionToDirectCheckImpl(bool CheckMakePair, bool CheckMakeOptional,
+                              bool CheckMakeTuple) {
+  std::vector<RewriteRuleWith<std::string>> Rules;
+
+  // Helper to create a rule for a specific make_* function
+  auto createRule = [](StringRef MakeFunction, StringRef DirectType) {
+    auto WarningMessage = cat("use class template argument deduction (CTAD) "
+                              "instead of ",
+                              MakeFunction);
+
+    return makeRule(
+        callExpr(callee(functionDecl(hasName(MakeFunction))),
+                 unless(hasParent(implicitCastExpr(hasImplicitDestinationType(
+                     
qualType(hasCanonicalType(qualType(asString("void")))))))))
----------------
vbvictor wrote:

Could you please elaborate why do you need this `unless(hasParen(...))` in your 
check?
I didn't find tests that will use this behavior, or I couldn't understand what 
existing test used it:(

https://github.com/llvm/llvm-project/pull/118120
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to