================
@@ -378,20 +380,44 @@ class RawPtrRefCallArgsChecker
             ClsName.ends_with("String"));
   }
 
-  void reportBug(const Expr *CallArg, const ParmVarDecl *Param,
-                 const Decl *DeclWithIssue) const {
+  void reportBug(const NamedDecl *Callee, const Expr *CallArg,
+                 const ParmVarDecl *Param, const Decl *DeclWithIssue) const {
     assert(CallArg);
 
     SmallString<100> Buf;
     llvm::raw_svector_ostream Os(Buf);
 
     const std::string paramName = safeGetName(Param);
-    Os << "Call argument";
+    Os << "Function argument";
+    printArgument(Os, CallArg, DeclWithIssue);
+    if (!paramName.empty() || Callee)
+      Os << " (";
     if (!paramName.empty()) {
-      Os << " for parameter ";
+      Os << "parameter ";
       printQuotedQualifiedName(Os, Param);
     }
-    Os << " is " << ptrKind() << " and unsafe.";
+    if (Callee) {
+      if (!paramName.empty())
+        Os << " ";
+      Os << "to ";
+      printQuotedQualifiedName(Os, Callee);
+    }
+    if (!paramName.empty() || Callee)
+      Os << ")";
+    Os << " is a ";
+    auto *ArgType = CallArg->getType().getTypePtr();
+
+    if (printPointer(Os, ArgType) == PrintDeclKind::Pointer) {
+      assert(RTC);
+      if (auto *Decl = RTC->getCanonicalDecl(CallArg->getType()))
+        printQuotedQualifiedName(Os, Decl);
+      else {
+        auto Typedef = ArgType->getAs<TypedefType>();
+        assert(Typedef);
+        printQuotedQualifiedName(Os, Typedef->getDecl());
+      }
+    } else
+      printType(Os, CallArg->getType());
----------------
steakhal wrote:

```suggestion
    } else {
      printType(Os, CallArg->getType());
    }
```

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

Reply via email to