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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 19 17:52:00 PDT 2019


NoQ added a comment.

Also thanks, everything makes sense now!

Do we already have a test that will cover the necessity for having a map from regions to cast results? Eg.:

  void foo(Shape *C, Shape *T) {
    if (isa<Circle>(S) && !isa<Circle>(T))
      clang_analyzer_warnIfReached(); // expected-warning{{TRUE}}
  }



================
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}}
----------------
We're not assuming it, right? We already know it's gonna fail because we already know that it's a circle.


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

https://reviews.llvm.org/D66325





More information about the cfe-commits mailing list