diff options
| author | Anders Carlsson <andersca@mac.com> | 2010-03-24 00:35:44 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2010-03-24 00:35:44 +0000 |
| commit | 4a3cdf5ac7edbf2f2265ded1a5ab9147b0b706c6 (patch) | |
| tree | 1dda11d13bfde2c334d635d5e80cc1f2fe7ca8af /clang/lib/CodeGen | |
| parent | 3537413c4aa66368f6e311d9fa86b8fa02eaa190 (diff) | |
| download | bcm5719-llvm-4a3cdf5ac7edbf2f2265ded1a5ab9147b0b706c6.tar.gz bcm5719-llvm-4a3cdf5ac7edbf2f2265ded1a5ab9147b0b706c6.zip | |
Minor cleanup.
llvm-svn: 99364
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGVtable.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CGVtable.cpp b/clang/lib/CodeGen/CGVtable.cpp index 9204e4e565c..fae0f362b1c 100644 --- a/clang/lib/CodeGen/CGVtable.cpp +++ b/clang/lib/CodeGen/CGVtable.cpp @@ -3668,22 +3668,20 @@ llvm::Constant *CodeGenModule::GetAddrOfThunk(GlobalDecl GD, void CodeGenVTables::EmitThunk(GlobalDecl GD, const ThunkInfo &Thunk) { - llvm::Constant *ThunkFn = CGM.GetAddrOfThunk(GD, Thunk); + llvm::Constant *Entry = CGM.GetAddrOfThunk(GD, Thunk); const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl()); // Strip off a bitcast if we got one back. - if (llvm::ConstantExpr *CE = dyn_cast<llvm::ConstantExpr>(ThunkFn)) { + if (llvm::ConstantExpr *CE = dyn_cast<llvm::ConstantExpr>(Entry)) { assert(CE->getOpcode() == llvm::Instruction::BitCast); - ThunkFn = CE->getOperand(0); + Entry = CE->getOperand(0); } - const llvm::Type *ThunkFnTy = - cast<llvm::GlobalValue>(ThunkFn)->getType()->getElementType(); - // There's already a declaration with the same name, check if it has the same // type or if we need to replace it. - if (ThunkFnTy != CGM.getTypes().GetFunctionTypeForVtable(MD)) { - llvm::GlobalValue *OldThunkFn = cast<llvm::GlobalValue>(ThunkFn); + if (cast<llvm::GlobalValue>(Entry)->getType()->getElementType() != + CGM.getTypes().GetFunctionTypeForVtable(MD)) { + llvm::GlobalValue *OldThunkFn = cast<llvm::GlobalValue>(Entry); // If the types mismatch then we have to rewrite the definition. assert(OldThunkFn->isDeclaration() && @@ -3691,12 +3689,12 @@ void CodeGenVTables::EmitThunk(GlobalDecl GD, const ThunkInfo &Thunk) // Remove the name from the old thunk function and get a new thunk. OldThunkFn->setName(llvm::StringRef()); - ThunkFn = CGM.GetAddrOfThunk(GD, Thunk); + Entry = CGM.GetAddrOfThunk(GD, Thunk); // If needed, replace the old thunk with a bitcast. if (!OldThunkFn->use_empty()) { llvm::Constant *NewPtrForOldDecl = - llvm::ConstantExpr::getBitCast(ThunkFn, OldThunkFn->getType()); + llvm::ConstantExpr::getBitCast(Entry, OldThunkFn->getType()); OldThunkFn->replaceAllUsesWith(NewPtrForOldDecl); } |

