[PATCH] [analyzer] Small improvement for the empty class issue

Pavel Labath labath at google.com
Mon Sep 2 02:47:57 PDT 2013


Hi jordan_rose,

rsmith suggested using CXXRecordDecl::isEmpty() instead, as it "also checks for
virtual functions/virtual bases, and handles the case where the only fields are
zero-length bitfields"

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

Files:
  lib/StaticAnalyzer/Core/RegionStore.cpp

Index: lib/StaticAnalyzer/Core/RegionStore.cpp
===================================================================
--- lib/StaticAnalyzer/Core/RegionStore.cpp
+++ lib/StaticAnalyzer/Core/RegionStore.cpp
@@ -1836,7 +1836,7 @@
   if (!RD->field_empty())
     return false;
   if (const CXXRecordDecl *CRD = dyn_cast<CXXRecordDecl>(RD))
-    return CRD->getNumBases() == 0;
+    return CRD->isEmpty();
   return true;
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1573.1.patch
Type: text/x-patch
Size: 420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130902/559281dd/attachment.bin>


More information about the cfe-commits mailing list