[PATCH] D79895: Add a new warning to warn when passing uninitialized variables as const reference parameters to a function
Zequan Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 2 13:10:44 PDT 2020
zequanwu marked an inline comment as done.
zequanwu added inline comments.
================
Comment at: clang/lib/Analysis/UninitializedValues.cpp:676
+ Value v = vals[vd];
+ if (isUninitialized(v))
+ handler.handleConstRefUseOfUninitVariable(vd, getUninitUse(ex, vd, v));
----------------
MaskRay wrote:
> This should use isAlwaysUninit. I fixed it in 7096e04a6831d4668c39b388ccd166f84de69191
>
> Otherwise there are multiple false positives in stage2 build of llvm-project, e.g.
>
> ```
> if (a < 42)
> var = 1;
> if (a < 42)
> const_ref_use(var);
> ```
Thanks for the fix
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79895/new/
https://reviews.llvm.org/D79895
More information about the cfe-commits
mailing list