r178297 - [sema] Check the result of getAsCXXRecordDecl() to fix the build

Reid Kleckner reid at kleckner.net
Thu Mar 28 15:15:11 PDT 2013


Author: rnk
Date: Thu Mar 28 17:15:11 2013
New Revision: 178297

URL: http://llvm.org/viewvc/llvm-project?rev=178297&view=rev
Log:
[sema] Check the result of getAsCXXRecordDecl() to fix the build

I'm not 100% sure what should happen here to find the real
CXXRecordDecl.

Modified:
    cfe/trunk/lib/Sema/SemaType.cpp

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=178297&r1=178296&r2=178297&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Thu Mar 28 17:15:11 2013
@@ -1733,12 +1733,12 @@ QualType Sema::BuildMemberPointerType(Qu
   // when passing pointers between TUs that disagree about the size.
   if (Context.getTargetInfo().getCXXABI().isMicrosoft()) {
     CXXRecordDecl *RD = Class->getAsCXXRecordDecl();
-    if (!RD->hasAttr<MSInheritanceAttr>()) {
+    if (!RD || !RD->hasAttr<MSInheritanceAttr>()) {
       // Lock in the inheritance model on the first use of a member pointer.
       // Otherwise we may disagree about the size at different points in the TU.
       // FIXME: MSVC picks a model on the first use that needs to know the size,
       // rather than on the first mention of the type, e.g. typedefs.
-      if (RequireCompleteType(Loc, Class, 0) && !RD->isBeingDefined()) {
+      if (RequireCompleteType(Loc, Class, 0) && RD && !RD->isBeingDefined()) {
         // We know it doesn't have an attribute and it's incomplete, so use the
         // unspecified inheritance model.  If we're in the record body, we can
         // figure out the inheritance model.





More information about the cfe-commits mailing list