ASDenysPetrov added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Core/SVals.cpp:154
+ Optional<QualType> VisitLocGotoLabel(loc::GotoLabel GL) {
+ return QualType{Context.VoidPtrTy};
+ }
----------------
NoQ wrote:
> ASDenysPetrov wrote:
> > vsavchenko wrote:
> > > ASDenysPetrov wrote:
> > > > I'm not sure this is a correct type. I would expect here something
> > > > like: `class LabelType : public Type`.
> > > I don't think that I fully understood what you suggest here. Do you
> > > suggest to add a new type to `Type.h`?
> > Yes. As a user I expect to see some special type for labels, not a `void*`.
> > But for the absence of such type let it be as is.
> `void *` is the correct type for label values, as defined in the
> documentation of the respective GNU extension to C (which Clang
> mimics/supports):
>
> https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
> > You can get the address of a label defined in the current function (or a
> > containing function) with the unary operator '`&&`'. The value has type
> > `void *`.
OK, I see. As a MSVC user I never met this feature neither in a real code nor
in the Standard. I've just checked the feature in Godbolt and MSVC is almost
the only one which doesn't support it.
I'm OK with `void*`, since a user has additional information that this also is
a `GotoLabel` to handle whatever way it want.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104550/new/
https://reviews.llvm.org/D104550
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits