From 3d4218570ad4c87ea86cf709da78d6e450476d01 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Tue, 20 Apr 2010 05:07:22 +0000 Subject: [PATCH] Assert that the path from the derived to the base class in CodeGenFunction::GetAddressOfBaseClass is not ambiguous. llvm-svn: 101869 --- clang/lib/CodeGen/CGClass.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 42b0591f3844..5e7cc4b51484 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/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(Class)-> isDerivedFrom(const_cast(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;