[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 11:14:02 PDT 2019


NoQ added inline comments.


================
Comment at: clang/test/Analysis/cast-value-state-dump.cpp:30
+  if (dyn_cast_or_null<Triangle>(C)) {
+    // expected-note at -1 {{Assuming dynamic cast from 'Circle' to 'Triangle' fails}}
+    // expected-note at -2 {{Taking false branch}}
----------------
Charusso wrote:
> NoQ wrote:
> > We're not assuming it, right? We already know it's gonna fail because we already know that it's a circle.
> We have no knowledge what is what. At the top we see that: `Shape -> Circle`, and then `Triangle -> Circle` is something new, so we have to assume that. It is an implementation detail we are allowing only one cast to be succeed. From the user point of view it is an assumption as the current state of the checker could not provide more/better information. It is the same logic from the `ConditionBRVisitor`.
Yeah, but it's not the observable behavior we'll be trying to preserve, so i suggest a FIXME.


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

https://reviews.llvm.org/D66325





More information about the cfe-commits mailing list