================
@@ -21,6 +21,29 @@ using namespace clang::ast_matchers;
 
 namespace clang::tidy::modernize {
 
+namespace {
+AST_MATCHER(FunctionDecl, isOverloaded) {
+  const DeclarationName Name = Node.getDeclName();
+  // Skip lambda-like functions
+  if (Name.isEmpty())
+    return false;
+  const DeclContext *DC = Node.getDeclContext();
+  auto LookupResult = DC->lookup(Name);
+  size_t UniqueSignatures = 0;
+  llvm::SmallPtrSet<const FunctionDecl *, 2> SeenFunctions;
+  for (NamedDecl *ND : LookupResult) {
+    if (const auto *FD = dyn_cast<FunctionDecl>(ND)) {
----------------
irishrover wrote:

Sorry, I did not understand the case. Do you mean something like

```
double overload;
std::string overload(int) { return "int"; }
std::string overload(std::string) { return "string"; }
```
? But it has invalid syntax.

https://github.com/llvm/llvm-project/pull/183921
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to