[clang] [analyzer] MallocChecker – Fix false positive leak for smart pointers in temporary objects (PR #152751)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 9 11:26:27 PDT 2025


================
@@ -3107,24 +3111,13 @@ void MallocChecker::checkDeadSymbols(SymbolReaper &SymReaper,
   C.addTransition(state->set<RegionState>(RS), N);
 }
 
-static QualType canonicalStrip(QualType QT) {
-  return QT.getCanonicalType().getUnqualifiedType();
-}
-
-static bool isInStdNamespace(const DeclContext *DC) {
-  while (DC) {
-    if (const auto *NS = dyn_cast<NamespaceDecl>(DC))
-      if (NS->isStdNamespace())
-        return true;
-    DC = DC->getParent();
-  }
-  return false;
-}
+// Use isWithinStdNamespace from CheckerHelpers.h instead of custom
+// implementation
----------------
steakhal wrote:

Is this comment still relevant?

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


More information about the cfe-commits mailing list