[cfe-commits] r92123 - /cfe/trunk/lib/CodeGen/CGVtable.cpp
Mike Stump
mrs at apple.com
Wed Dec 23 23:29:42 PST 2009
Author: mrs
Date: Thu Dec 24 01:29:41 2009
New Revision: 92123
URL: http://llvm.org/viewvc/llvm-project?rev=92123&view=rev
Log:
Remove some dead code.
Modified:
cfe/trunk/lib/CodeGen/CGVtable.cpp
Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=92123&r1=92122&r2=92123&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Thu Dec 24 01:29:41 2009
@@ -483,13 +483,13 @@
}
- Index_t FinishGenerateVtable(const CXXRecordDecl *RD,
- const ASTRecordLayout &Layout,
- const CXXRecordDecl *PrimaryBase,
- bool PrimaryBaseWasVirtual,
- bool MorallyVirtual, int64_t Offset,
- bool ForVirtualBase, int64_t CurrentVBaseOffset,
- Path_t *Path) {
+ void FinishGenerateVtable(const CXXRecordDecl *RD,
+ const ASTRecordLayout &Layout,
+ const CXXRecordDecl *PrimaryBase,
+ bool PrimaryBaseWasVirtual,
+ bool MorallyVirtual, int64_t Offset,
+ bool ForVirtualBase, int64_t CurrentVBaseOffset,
+ Path_t *Path) {
bool alloc = false;
if (Path == 0) {
alloc = true;
@@ -537,7 +537,6 @@
if (alloc) {
delete Path;
}
- return AddressPoint;
}
void Primaries(const CXXRecordDecl *RD, bool MorallyVirtual, int64_t Offset,
@@ -602,19 +601,19 @@
}
}
- int64_t GenerateVtableForBase(const CXXRecordDecl *RD, int64_t Offset = 0,
- bool MorallyVirtual = false,
- bool ForVirtualBase = false,
- int CurrentVBaseOffset = 0,
- Path_t *Path = 0) {
+ void GenerateVtableForBase(const CXXRecordDecl *RD, int64_t Offset = 0,
+ bool MorallyVirtual = false,
+ bool ForVirtualBase = false,
+ int CurrentVBaseOffset = 0,
+ Path_t *Path = 0) {
if (!RD->isDynamicClass())
- return 0;
+ return;
// Construction vtable don't need parts that have no virtual bases and
// aren't morally virtual.
if ((LayoutClass != MostDerivedClass) &&
RD->getNumVBases() == 0 && !MorallyVirtual)
- return 0;
+ return;
const ASTRecordLayout &Layout = CGM.getContext().getASTRecordLayout(RD);
const CXXRecordDecl *PrimaryBase = Layout.getPrimaryBase();
@@ -633,9 +632,9 @@
if (Path)
OverrideMethods(Path, MorallyVirtual, Offset, CurrentVBaseOffset);
- return FinishGenerateVtable(RD, Layout, PrimaryBase, PrimaryBaseWasVirtual,
- MorallyVirtual, Offset, ForVirtualBase,
- CurrentVBaseOffset, Path);
+ FinishGenerateVtable(RD, Layout, PrimaryBase, PrimaryBaseWasVirtual,
+ MorallyVirtual, Offset, ForVirtualBase,
+ CurrentVBaseOffset, Path);
}
void GenerateVtableForVBases(const CXXRecordDecl *RD,
@@ -1158,22 +1157,13 @@
CGM.getMangleContext().mangleCXXVtable(RD, OutName);
llvm::StringRef Name = OutName.str();
- int64_t AddressPoint;
-
llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name);
- if (GV && CGM.AddressPoints[LayoutClass] && !GV->isDeclaration()) {
- AddressPoint=(*(*(CGM.AddressPoints[LayoutClass]))[RD])[std::make_pair(RD,
- Offset)];
- // FIXME: We can never have 0 address point. Do this for now so gepping
- // retains the same structure. Later, we'll just assert.
- if (AddressPoint == 0)
- AddressPoint = 1;
- } else {
+ if (GV == 0 || CGM.AddressPoints[LayoutClass] == 0 || GV->isDeclaration()) {
VtableBuilder b(RD, LayoutClass, Offset, CGM, GenerateDefinition);
D1(printf("vtable %s\n", RD->getNameAsCString()));
// First comes the vtables for all the non-virtual bases...
- AddressPoint = b.GenerateVtableForBase(RD, Offset);
+ b.GenerateVtableForBase(RD, Offset);
// then the vtables for all the virtual bases.
b.GenerateVtableForVBases(RD, Offset);
More information about the cfe-commits
mailing list