simplify code.

llvm-svn: 94401
This commit is contained in:
Chris Lattner
2010-01-25 03:29:35 +00:00
parent a1141dd6ab
commit bf78478d35
2 changed files with 13 additions and 23 deletions

View File

@@ -777,10 +777,9 @@ CodeGenFunction::GenerateBlockFunction(const BlockExpr *BExpr,
if (CGDebugInfo *DI = getDebugInfo()) { if (CGDebugInfo *DI = getDebugInfo()) {
// Emit debug information for all the BlockDeclRefDecls. // Emit debug information for all the BlockDeclRefDecls.
for (unsigned i=0; i < BlockDeclRefDecls.size(); ++i) { for (unsigned i = 0, e = BlockDeclRefDecls.size(); i != e; ++i) {
const Expr *E = BlockDeclRefDecls[i]; if (const BlockDeclRefExpr *BDRE =
const BlockDeclRefExpr *BDRE = dyn_cast<BlockDeclRefExpr>(E); dyn_cast<BlockDeclRefExpr>(BlockDeclRefDecls[i])) {
if (BDRE) {
const ValueDecl *D = BDRE->getDecl(); const ValueDecl *D = BDRE->getDecl();
DI->setLocation(D->getLocation()); DI->setLocation(D->getLocation());
DI->EmitDeclareOfBlockDeclRefVariable(BDRE, DI->EmitDeclareOfBlockDeclRefVariable(BDRE,

View File

@@ -1498,30 +1498,21 @@ void CGDebugInfo::EmitDeclare(const BlockDeclRefExpr *BDRE, unsigned Tag,
CharUnits offset = CGF->BlockDecls[Decl]; CharUnits offset = CGF->BlockDecls[Decl];
llvm::SmallVector<llvm::Value *, 9> addr; llvm::SmallVector<llvm::Value *, 9> addr;
llvm::LLVMContext &VMContext = CGM.getLLVMContext(); const llvm::Type *Int64Ty = llvm::Type::getInt64Ty(CGM.getLLVMContext());
addr.push_back(llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext), addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIFactory::OpDeref));
llvm::DIFactory::OpDeref)); addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIFactory::OpPlus));
addr.push_back(llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext), addr.push_back(llvm::ConstantInt::get(Int64Ty, offset.getQuantity()));
llvm::DIFactory::OpPlus));
addr.push_back(llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext),
offset.getQuantity()));
if (BDRE->isByRef()) { if (BDRE->isByRef()) {
addr.push_back(llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext), addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIFactory::OpDeref));
llvm::DIFactory::OpDeref)); addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIFactory::OpPlus));
addr.push_back(llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext),
llvm::DIFactory::OpPlus));
// offset of __forwarding field // offset of __forwarding field
offset = CharUnits::fromQuantity(CGF->LLVMPointerWidth/8); offset = CharUnits::fromQuantity(CGF->LLVMPointerWidth/8);
addr.push_back(llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext), addr.push_back(llvm::ConstantInt::get(Int64Ty, offset.getQuantity()));
offset.getQuantity())); addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIFactory::OpDeref));
addr.push_back(llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext), addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIFactory::OpPlus));
llvm::DIFactory::OpDeref));
addr.push_back(llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext),
llvm::DIFactory::OpPlus));
// offset of x field // offset of x field
offset = CharUnits::fromQuantity(XOffset/8); offset = CharUnits::fromQuantity(XOffset/8);
addr.push_back(llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext), addr.push_back(llvm::ConstantInt::get(Int64Ty, offset.getQuantity()));
offset.getQuantity()));
} }
// Create the descriptor for the variable. // Create the descriptor for the variable.