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

Csaba Dabis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 21 15:58:42 PDT 2019


Charusso marked an inline comment as done.
Charusso added inline comments.


================
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())
----------------
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?


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

https://reviews.llvm.org/D66325





More information about the cfe-commits mailing list