[PATCH] D66325: [analyzer] CastValueChecker: Store the dynamic types and casts

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 21 16:35:47 PDT 2019


NoQ added a comment.

Let's land this then!~~



================
Comment at: clang/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp:83-93
+static QualType getRecordType(QualType Ty) {
+  Ty = Ty.getCanonicalType();
+
+  if (Ty->isPointerType())
+    return getRecordType(Ty->getPointeeType());
 
+  if (Ty->isReferenceType())
----------------
Charusso wrote:
> NoQ wrote:
> > NoQ wrote:
> > > Most of the time we should know exactly how many pointer/reference types we need to unwrap. I really prefer we hard-assert this knowledge instead of blindly unwrapping as many pointer/reference types as we want. Because every time we have an unexpected number of unwraps it's an indication that something went horribly wrong. So it's good to have the extra sanity checking.
> > I think this one is still forgotten. Maybe a FIXME?
> Now I pattern-match that rule in the `evalCall()`, therefore we cannot try to evaluate nested references. Would you like to see more checks?
Oh, i see, you removed the recursion. Great.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66325/new/

https://reviews.llvm.org/D66325





More information about the cfe-commits mailing list