summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGClass.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-05-03 00:32:27 +0000
committerAnders Carlsson <andersca@mac.com>2010-05-03 00:32:27 +0000
commitf4da2cf20a8bea52a6acf82dd47c86b24c3e7260 (patch)
tree9ff74ca1e72443dce5b6d46112ec29c63c3401c0 /clang/lib/CodeGen/CGClass.cpp
parentc58fb552f327a7af1806b8e8f7fabfd7503023b6 (diff)
downloadbcm5719-llvm-f4da2cf20a8bea52a6acf82dd47c86b24c3e7260.tar.gz
bcm5719-llvm-f4da2cf20a8bea52a6acf82dd47c86b24c3e7260.zip
Remove OldGetAddressOfBaseClass - bye bye ambiguities.
llvm-svn: 102889
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r--clang/lib/CodeGen/CGClass.cpp91
1 files changed, 0 insertions, 91 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index a070b7f55e9..6e7208bdcbd 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/lib/CodeGen/CGClass.cpp
@@ -47,31 +47,6 @@ ComputeNonVirtualBaseClassOffset(ASTContext &Context,
// FIXME: We should not use / 8 here.
return Offset / 8;
}
-
-static uint64_t
-ComputeNonVirtualBaseClassOffset(ASTContext &Context,
- const CXXBasePath &Path,
- unsigned Start) {
- uint64_t Offset = 0;
-
- for (unsigned i = Start, e = Path.size(); i != e; ++i) {
- const CXXBasePathElement& Element = Path[i];
-
- // Get the layout.
- const ASTRecordLayout &Layout = Context.getASTRecordLayout(Element.Class);
-
- const CXXBaseSpecifier *BS = Element.Base;
- assert(!BS->isVirtual() && "Should not see virtual bases here!");
-
- const CXXRecordDecl *Base =
- cast<CXXRecordDecl>(BS->getType()->getAs<RecordType>()->getDecl());
-
- // Add the offset.
- Offset += Layout.getBaseClassOffset(Base) / 8;
- }
-
- return Offset;
-}
llvm::Constant *
CodeGenModule::GetNonVirtualBaseClassOffset(const CXXRecordDecl *ClassDecl,
@@ -229,72 +204,6 @@ CodeGenFunction::GetAddressOfBaseClass(llvm::Value *Value,
}
llvm::Value *
-CodeGenFunction::OldGetAddressOfBaseClass(llvm::Value *Value,
- const CXXRecordDecl *Class,
- const CXXRecordDecl *BaseClass) {
- QualType BTy =
- getContext().getCanonicalType(
- getContext().getTypeDeclType(BaseClass));
- const llvm::Type *BasePtrTy = llvm::PointerType::getUnqual(ConvertType(BTy));
-
- if (Class == BaseClass) {
- // Just cast back.
- 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;
- }
-
-#if 0
- // FIXME: Re-enable this assert when the underlying bugs have been fixed.
- assert(!Paths.isAmbiguous(BTy) && "Path is ambiguous");
-#endif
-
- unsigned Start = 0;
-
- const CXXBasePath &Path = Paths.front();
- const CXXRecordDecl *VBase = 0;
- for (unsigned i = 0, e = Path.size(); i != e; ++i) {
- const CXXBasePathElement& Element = Path[i];
- if (Element.Base->isVirtual()) {
- Start = i+1;
- QualType VBaseType = Element.Base->getType();
- VBase = cast<CXXRecordDecl>(VBaseType->getAs<RecordType>()->getDecl());
- }
- }
-
- uint64_t Offset =
- ComputeNonVirtualBaseClassOffset(getContext(), Paths.front(), Start);
-
- if (!Offset && !VBase) {
- // Just cast back.
- return Builder.CreateBitCast(Value, BasePtrTy);
- }
-
- llvm::Value *VirtualOffset = 0;
-
- if (VBase)
- VirtualOffset = GetVirtualBaseClassOffset(Value, Class, VBase);
-
- // Apply the offsets.
- Value = ApplyNonVirtualAndVirtualOffset(*this, Value, Offset, VirtualOffset);
-
- // Cast back.
- Value = Builder.CreateBitCast(Value, BasePtrTy);
- return Value;
-}
-
-llvm::Value *
CodeGenFunction::GetAddressOfDerivedClass(llvm::Value *Value,
const CXXRecordDecl *Derived,
const CXXBaseSpecifierArray &BasePath,
OpenPOWER on IntegriCloud