[PATCH] Fix static analyzer crash when casting from an incomplete type

Jordan Rose jordan_rose at apple.com
Wed Jun 19 09:40:06 PDT 2013


  Looks good. After the comment fix, go ahead and commit.


================
Comment at: lib/StaticAnalyzer/Core/Store.cpp:328-329
@@ -327,2 +327,4 @@
 
-    if (!TargetType->isVoidType()) {
+    // We skip over incomplete types. They must be the result of an earlier
+    // reinterpret_cast, as one cannot dynamically cast from an incomplete type.
+    if (!TargetType->isVoidType() && MRClass->isCompleteDefinition()) {
----------------
More explicit: "as one can only dynamic_cast between types in the same class hierarchy". That's a stronger rule that the completeness requirement comes from.


http://llvm-reviews.chandlerc.com/D1006



More information about the cfe-commits mailing list