[clang] [libcxx] [clang] Fix -Wuninitialized for values passed by const pointers (PR #147221)
Gábor Horváth via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 7 03:48:39 PDT 2025
================
@@ -438,13 +438,10 @@ void ClassifyRefs::VisitCallExpr(CallExpr *CE) {
return;
}
bool isTrivialBody = hasTrivialBody(CE);
- // If a value is passed by const pointer to a function,
- // we should not assume that it is initialized by the call, and we
- // conservatively do not assume that it is used.
- // If a value is passed by const reference to a function,
- // it should already be initialized.
- for (CallExpr::arg_iterator I = CE->arg_begin(), E = CE->arg_end();
- I != E; ++I) {
+ // A value passed by const pointer or reference to a function should already
+ // be initialized.
+ for (CallExpr::arg_iterator I = CE->arg_begin(), E = CE->arg_end(); I != E;
----------------
Xazax-hun wrote:
Could this use `CE->arguments()` in a range based for loop instead?
https://github.com/llvm/llvm-project/pull/147221
More information about the cfe-commits
mailing list