[PATCH] [analyzer] Do not reinitialize static globals when the function is called more than once along a path
Ted Kremenek
kremenek at apple.com
Thu Feb 7 00:00:13 PST 2013
On Feb 6, 2013, at 5:07 PM, Anna Zaks <ganna at apple.com> wrote:
> Attached is a new patch, which uses GDM to store the VarDecls of globals previously initialized along the path.
>
> Thanks for the suggestion,
> Anna.
Thanks Anna. Looks like the right approach, but this looks suspicious:
+ const VarDecl *VD = dyn_cast<VarDecl>(D);
+
+ if (!D || !VD) {
//TODO:AZ: remove explicit insertion after refactoring is done.
Dst.insert(Pred);
return;
}
If 'D' can be null, then the dyn_cast<> can crash. The safe code would be:
const VarDecl *VD = dyn_cast_or_null<VarDecl>(D);
if (!VD) {
…
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130207/e2551236/attachment.html>
More information about the cfe-commits
mailing list