[cfe-commits] r128843 - in /cfe/trunk: lib/Sema/AnalysisBasedWarnings.cpp test/Sema/uninit-variables.c
Chris Lattner
clattner at apple.com
Mon Apr 4 14:56:35 PDT 2011
On Apr 4, 2011, at 1:56 PM, Ted Kremenek wrote:
> Author: kremenek
> Date: Mon Apr 4 15:56:00 2011
> New Revision: 128843
>
> URL: http://llvm.org/viewvc/llvm-project?rev=128843&view=rev
> Log:
> -Wuninitialized: use "self-init" warning when issue uninitialized values warnings from the dataflow analysis that include within the initializer of a variable.
Ok, but:
> const bool isAlwaysUninit = vi->second;
> if (const DeclRefExpr *dr = dyn_cast<DeclRefExpr>(vi->first)) {
> S.Diag(dr->getLocStart(),
> + isAlwaysUninit ?
> + (isSelfInit(S.Context, vd, dr)
> + ? diag::warn_uninit_self_reference_in_init
> + : diag::warn_uninit_var)
> + : diag::warn_maybe_uninit_var)
> << vd->getDeclName() << dr->getSourceRange();
This is really ugly. Please do something like:
unsigned DiagID = diag::warn_uninit_var;
// comment here.
if (...)
DiagID = diag::warn_uninit_self_reference_in_init;
S.Diag(.. , DiagID, ...)
Thanks,
-Chris
More information about the cfe-commits
mailing list