[cfe-dev] [PATCH] Move some code into GRSimpleVals

Zhongxing Xu mymlreader at gmail.com
Mon Aug 18 23:43:15 PDT 2008


> This patch looks really awesome.  The only problem I see is that
> VisitDeclStmt doesn't handle the fact that a local variable is uninitialized
> before VisitDeclStmt is called (this poses a problem because the Expr* for
> the initializer is visited before the DeclStmt).  That's why local variables
> are initialized to UndefinedVal.  Observe that the test case
> Analysis/uninit-ps-rdar6145427.m fails because of this change (run 'make
> test').
>
> I think the solution is to leave in:
>
>      RVal X = (VD->hasGlobalStorage() || isa<ParmVarDecl>(VD) ||
>                isa<ImplicitParamDecl>(VD))
>             ? RVal::GetSymbolValue(SymMgr, VD)
>             : UndefinedVal();
>
> instead of:
>
>        // Only handle globals and parameters here. Local variables are
> handled
>        // in VisitDeclStmt().
>        if (VD->hasGlobalStorage() || isa<ParmVarDecl>(VD) ||
>            isa<ImplicitParamDecl>(VD)) {
>          RVal X = RVal::GetSymbolValue(StateMgr.getSymbolManager(), VD);
>          St = SetRVal(St, lval::DeclVal(VD), X);
>        }
> Ted


New patch is attached.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080819/42ecc701/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getInitialStore2.patch
Type: application/octet-stream
Size: 7422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080819/42ecc701/attachment.obj>


More information about the cfe-dev mailing list