================
@@ -8454,26 +8454,47 @@ static bool IsInfOrNanFunction(StringRef calleeName, 
MathCheck Check) {
   llvm_unreachable("unknown MathCheck");
 }
 
+static bool IsInfinityFunction(const FunctionDecl *FDecl) {
+  if (FDecl->getName() != "infinity") {
+    return false;
+  }
+
+  if (const CXXMethodDecl *MDecl = dyn_cast<CXXMethodDecl>(FDecl)) {
+    const CXXRecordDecl *RDecl = MDecl->getParent();
+    if (RDecl->getName() != "numeric_limits") {
+      return false;
+    }
+
+    if (const NamespaceDecl *NSDecl =
+            dyn_cast<NamespaceDecl>(RDecl->getDeclContext())) {
+      return NSDecl->isStdNamespace();
+    }
+  }
+
+  return false;
+}
+
----------------
cor3ntin wrote:

```suggestion
  if (FDecl->getName() != "infinity")
    return false;

  if (const CXXMethodDecl *MDecl = dyn_cast<CXXMethodDecl>(FDecl)) {
    const CXXRecordDecl *RDecl = MDecl->getParent();
    if (RDecl->getName() != "numeric_limits")
      return false;

    if (const NamespaceDecl *NSDecl =
            dyn_cast<NamespaceDecl>(RDecl->getDeclContext()))
      return NSDecl->isStdNamespace();
  }

  return false;
}

```

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

Reply via email to