[PATCH] D85528: [analyzer] Fix cast evaluation on scoped enums in ExprEngine
Whisperity via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 7 09:23:07 PDT 2020
whisperity added inline comments.
================
Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h:98-104
+ const auto IsIntegralOrUnscopedCompleteEnumerationType = [](QualType Ty) {
+ const Type *CanonicalType = Ty.getCanonicalType().getTypePtr();
+ if (const auto *ET = dyn_cast<EnumType>(CanonicalType))
+ return ET->getDecl()->isComplete() && !ET->getDecl()->isScoped();
+
+ return Ty->isIntegralOrEnumerationType();
+ };
----------------
whisperity wrote:
> steakhal wrote:
> > vsavchenko wrote:
> > > I don't really see any reasons why is this a lambda and not a free function
> > It's somewhat domain-specific that we require:
> > - `bool-uint128` builtin types
> > - complete, scoped `enum` types ((I think we need completeness for the analysis))
> >
> > ---
> > The one that comes quite close to these requirements was the `isIntegralOrEnumerationType`, but that does not check if the enum is //unscoped//.
> >
> > We can extend the `Type` header with this.
> > Should we go on that route?
> I think they meant that this function should be a lambda, but a function inside the current translation unit (either in namespace anonymous, or a member function of SValBuilder).
Edit: should //not// be
It does not have to go into `Type.h`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85528/new/
https://reviews.llvm.org/D85528
More information about the cfe-commits
mailing list