[clang-tools-extra] [clang-tidy] ignore uninitialized std::array in member init (PR #98134)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 9 07:15:37 PDT 2024


================
@@ -422,6 +422,28 @@ static const char *getInitializer(QualType QT, bool UseAssignment) {
   }
 }
 
+static bool isStdArray(QualType QT) {
+  const auto *RT = QT->getAs<RecordType>();
+  if (!RT)
+    return false;
+  const auto *RD = RT->getDecl();
+  if (!RD)
+    return false;
+
+  const IdentifierInfo *II = RD->getIdentifier();
+  if (!II)
+    return false;
+
+  if (II->getName() == "array") {
+    const NamespaceDecl *NS = dyn_cast<NamespaceDecl>(RD->getDeclContext());
----------------
EugeneZelenko wrote:

```suggestion
    const auto *NS = dyn_cast<NamespaceDecl>(RD->getDeclContext());
```

Type is spelled explicitly in same statement.

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


More information about the cfe-commits mailing list