summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-04-20 05:07:22 +0000
committerAnders Carlsson <andersca@mac.com>2010-04-20 05:07:22 +0000
commit3d4218570ad4c87ea86cf709da78d6e450476d01 (patch)
tree1f74f1af2829ff9206b8c2ff8ddfcf492db7a692
parent359675d036fb2bedf5406c165338ea5c08280968 (diff)
downloadbcm5719-llvm-3d4218570ad4c87ea86cf709da78d6e450476d01.tar.gz
bcm5719-llvm-3d4218570ad4c87ea86cf709da78d6e450476d01.zip
Assert that the path from the derived to the base class in CodeGenFunction::GetAddressOfBaseClass is not ambiguous.
llvm-svn: 101869
-rw-r--r--clang/lib/CodeGen/CGClass.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index 42b0591f384..5e7cc4b5148 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<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;
OpenPOWER on IntegriCloud