[cfe-dev] Getting DecompositionDecl from BindingDecl

Richard Smith via cfe-dev cfe-dev at lists.llvm.org
Thu Mar 29 16:37:45 PDT 2018


On 29 March 2018 at 15:08, George Karpenkov via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi Richard,
>
> Thanks for your reply!
>
> > Can you say more about why the static analyzer might want to map from a
> BindingDecl to a DecompositionDecl?
>
> One thing I couldn’t figure out is how to figure out whether a given
> binding represents a global.
> But turns out that for my use case turns out that somehow was not required.


I'm still not sure why you'd want to know that.

> BindingDecls should generally just be treated wrappers around some lvalue
> expression.
>
> Right, yes, that unfortunately forces quite a lot of special-casing on us,
> as suddenly in many places where we expected only a VarDecl we know get a
> BindingDecl.


What kind of places? The intended operational semantics are that when you
see a DeclRefExpr naming a BindingDecl, you evaluate its associated
subexpression. I'd imagine this is best modeled by generating CFG nodes for
the subexpression on each occurrence of such a DeclRefExpr, much like
(IIRC) is done for CXXDefaultArgExpr and CXXDefaultInitExpr. That seems
like it would not require too many special cases elsewhere.

(Perhaps the static analyzer needs more than that in order to produce more
user-friendly diagnostics?)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180329/6fd12397/attachment.html>


More information about the cfe-dev mailing list