[clang] [libcxx] [clang] Fix -Wuninitialized for values passed by const pointers (PR #147221)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 7 13:56:39 PDT 2025


================
@@ -453,7 +450,7 @@ void ClassifyRefs::VisitCallExpr(CallExpr *CE) {
       const auto *UO = dyn_cast<UnaryOperator>(Ex);
       if (UO && UO->getOpcode() == UO_AddrOf)
         Ex = UO->getSubExpr();
-      classify(Ex, Ignore);
+      classify(Ex, Use);
----------------
zygoloid wrote:

That said, rather than treating this case as `Ignore`, it seems best to treat it instead as `ConstRefUse`, since passing a local variable by const reference and passing its address by const pointer are analogous and should be treated the same way.

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


More information about the cfe-commits mailing list