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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 20 14:18:31 PDT 2019


NoQ added a comment.

Something went wrong with message generation, can you take a look?



================
Comment at: clang/test/Analysis/cast-value-notes.cpp:24
+  const auto &C = dyn_cast<Circle>(S);
+  // expected-note at -1 {{Assuming 'S' is a 'Circle', not a 'Shape'}}
+  // expected-note at -2 {{Dereference of null pointer}}
----------------
A circle is always a shape.

`Assuming 'S' is a 'Shape' that is not a 'Circle'` sounds about right.

Or just `Assuming 'S' is not a 'Circle'`.


================
Comment at: clang/test/Analysis/cast-value-notes.cpp:34
+  if (dyn_cast_or_null<Circle>(C)) {
+    // no-note: 'Assuming 'C' is a 'Circle', not a 'Circle''
+    return;
----------------
A circle is always a circle.


================
Comment at: clang/test/Analysis/cast-value-notes.cpp:55
+  if (dyn_cast_or_null<Triangle>(C)) {
+    // expected-note at -1 {{Assuming 'C' is a 'Triangle', not a 'Circle'}}
+    // expected-note at -2 {{Taking false branch}}
----------------
The `not a 'Circle'` part is suspiciously specific.


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

https://reviews.llvm.org/D66325





More information about the cfe-commits mailing list