Assert that the path from the derived to the base class in CodeGenFunction::GetAddressOfBaseClass is not ambiguous.

llvm-svn: 101869
This commit is contained in:
Anders Carlsson 2010-04-20 05:07:22 +00:00
parent 359675d036
commit 3d4218570a
1 changed files with 7 additions and 0 deletions

View 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;