[PATCH] [Clang/CodeGen] Prevent crash if destructor class is not accessible

Reid Kleckner rnk at google.com
Thu Jun 18 10:16:04 PDT 2015


================
Comment at: lib/CodeGen/CGClass.cpp:1296-1302
@@ -1295,5 +1295,9 @@
 {
+  // Give up if the destructor is not accessible.
+  if (!BaseClassDecl->getDestructor())
+    return false;
+
   // If the destructor is trivial we don't have to check anything else.
   if (BaseClassDecl->hasTrivialDestructor())
     return true;
 
----------------
I suspect you want to reorder these checks. The triviality check is a bittest, and getDestructor() may perform lookup.

http://reviews.llvm.org/D10508

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list