[PATCH] D104550: [analyzer] Implement getType for SVal
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 24 21:02:24 PDT 2021
NoQ added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Core/SVals.cpp:154
+ Optional<QualType> VisitLocGotoLabel(loc::GotoLabel GL) {
+ return QualType{Context.VoidPtrTy};
+ }
----------------
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 *`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104550/new/
https://reviews.llvm.org/D104550
More information about the cfe-commits
mailing list