]> granicus.if.org Git - clang/commitdiff
Assert that the path from the derived to the base class in CodeGenFunction::GetAddres...
authorAnders Carlsson <andersca@mac.com>
Tue, 20 Apr 2010 05:07:22 +0000 (05:07 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 20 Apr 2010 05:07:22 +0000 (05:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101869 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGClass.cpp

index 42b0591f3844be7e9d4dd8da217a94eccbbf3cd0..5e7cc4b51484ef1d07f7b80fc4034845970204ec 100644 (file)
@@ -120,14 +120,21 @@ CodeGenFunction::GetAddressOfBaseClass(llvm::Value *Value,
     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;