diff options
author | Anders Carlsson <andersca@mac.com> | 2010-04-20 05:07:22 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-04-20 05:07:22 +0000 |
commit | 2692d8284c77eee8ef3a93bf114cfec997a191a1 (patch) | |
tree | 30b0ecbf4b37950952c75029cfe1c5785c36d61d /lib/CodeGen/CGClass.cpp | |
parent | 58f9782219c6e31b680ba1a3b52c775889e4f6c1 (diff) |
Assert that the path from the derived to the base class in CodeGenFunction::GetAddressOfBaseClass is not ambiguous.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGClass.cpp')
-rw-r--r-- | lib/CodeGen/CGClass.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/CGClass.cpp b/lib/CodeGen/CGClass.cpp index 42b0591f38..5e7cc4b514 100644 --- a/lib/CodeGen/CGClass.cpp +++ b/lib/CodeGen/CGClass.cpp @@ -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; |