[cfe-commits] r101869 - /cfe/trunk/lib/CodeGen/CGClass.cpp

Anders Carlsson andersca at mac.com
Mon Apr 19 22:07:22 PDT 2010


Author: andersca
Date: Tue Apr 20 00:07:22 2010
New Revision: 101869

URL: http://llvm.org/viewvc/llvm-project?rev=101869&view=rev
Log:
Assert that the path from the derived to the base class in CodeGenFunction::GetAddressOfBaseClass is not ambiguous.

Modified:
    cfe/trunk/lib/CodeGen/CGClass.cpp

Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=101869&r1=101868&r2=101869&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Tue Apr 20 00:07:22 2010
@@ -120,14 +120,21 @@
     return Builder.CreateBitCast(Value, BasePtrTy);
   }
 
+#ifndef NDEBUG
+  CXXBasePaths Paths(/*FindAmbiguities=*/true,
+                     /*RecordPaths=*/true, /*DetectVirtual=*/false);
+#else
   CXXBasePaths Paths(/*FindAmbiguities=*/false,
                      /*RecordPaths=*/true, /*DetectVirtual=*/false);
+#endif
   if (!const_cast<CXXRecordDecl *>(Class)->
         isDerivedFrom(const_cast<CXXRecordDecl *>(BaseClass), Paths)) {
     assert(false && "Class must be derived from the passed in base class!");
     return 0;
   }
 
+  assert(!Paths.isAmbiguous(BTy) && "Path is ambiguous");
+
   unsigned Start = 0;
   llvm::Value *VirtualOffset = 0;
 





More information about the cfe-commits mailing list